Practice: Look at the following function header:
def foo(a, b, c, d, e)
answer the following questions:
In: Computer Science
1. Create a new class called Card that contains the following attributes: [3 K]
Suit (Clubs, Diamonds, Spades, Hearts)
Value (do not use Jack, Queen, King, Ace, instead, the value of your cards should be 1-13 where 11 = jack, 12 = Queen, 13 = King, and 1 = Ace)
Colour (Red or Black)
2. Make two constructions for your card: [2 A]
A default constructor for when you create an object without any arguments
A constructor that has 3 parameters, one for each attribute
Card should overwrite the corresponding print method to print the card nicely to the user with the following layout (colour does not need to be outputted): [1 K]
Value of Suit
ex. "5 of Hearts"
3. Card should also contain the following methods/functions:
isRed() – returns true or false if the card is Red [1 I]
isLarger(card)– takes in a card and returns the larger card according to the values. Note Ace (1) is smallest card and King (13) is largest. If the cards are the same, return the card the method is called on. [2 I]
copyCard() – creates and returns a new card object with all the same attributes [2 I]
In the main, feel free to test your methods in any way. The test cases will not be affected by any print statements. You must submit before lunch even if all the tests do not pass. Note that commenting is necessary and will count for 2 marks. [2 C]
[4 K, 5I, 2C, 2A]
Code:
Main.java
class Main {
public static void main(String[] args) {
}
}
Card.java
class Card {
}
In: Computer Science
Question 1. The following code asks the user to enter the password and check it with the pre-defined password that stored in the system. If the entered password is correct, it will authenticate the user to log-in into the account, otherwise reject!
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
char buff[8];
bool pass = true ;
printf("\n Enter the password : \n");
gets(buff);
if(strcmp(buff, "admin") ==0)
{
printf ("\n Correct Password \n");
pass = true;
}
else
{
printf ("\n Wrong Password \n");
pass = false;
}
if(pass)
{
/* authorized the user*/
printf ("\n Permission is given to the user \n");
}
return 0;
}
Submission
For this assignment, you need to write a report file of your work. The report should answer each question in details, providing outputs of the code to justify your answer.
In: Computer Science
This class contains the main method. In this class you should:
In: Computer Science
Intro to App Development with Swift by Apple education, Apple Education
ITEC245, iOS App Development
Description: Write a report with your self reflection and learning outcome on below topics:
1. Playground Basics with sample program , Naming and Identifiers with sample program , Strings with sample program , First App with sample program , Functions with sample program
In: Computer Science
Exercise 3.4.1
In P3_4_1.cpp (BELOW), right at the beginning, the program initializes choice to 1. This forces the while loop to run at least once. If you use a do ... while instead, you wouldn't need to initialize the choice. Re-write the below program, call the new program ex341.cpp, so that is uses do ... while. Do not initialize the choice to 1 this time. Compile and run the program.
Answer questions:
Does the program work the same way? Write your answer as a comment inside the code of your ex341.cpp file.
// P3_4_1.cpp - Read and average some integers, print the result.
// This program continue asking for a new number until the user enters a 0 to terminate the program
#include <iostream> using namespace std;
int main(void)
{ int x;
int count = 0; // (1) initialize a counter to 0 to count number of values
int choice = 1; // This is the choice that controls the looping continuation or termination
double sum = 0; // initialize sum to 0 to make sure sum at the beginning is 0
double average;
while( choice == 1) // (2) read N grades and compute their sum, count ensures N entries
{
// read each number and compute the sum:
cout << "\n Enter a grade <Enter>: ";
cin >> x;
sum = sum + x;
count++; // (3) update the count
// prompt the user:
cout << "Do you wish to enter another grade? (1 for yes and 0 or other key for no): "
<< endl;
cin >> choice;
}
if(count == 0)
cout << "You haven't entered any number. No average will be computed. Bye!\n";
else{
average = sum/count; //Notice that we have divided by count this time
cout << "The average of these " << count << " grades is " << average <<"." << endl;
}
return 0;
}
In: Computer Science
Implement a C program that writes and reads as binary data the first 1048576 = 2^20 integer individually to and from a file on HDD.
In: Computer Science
Question 2. The following code defines an array size that sums elements of the defined array through the loop.
#include <stdio.h>
#define A 10
int main(int argc, char** argv) {
int Total = 0;
int numbers[A];
for (int i=0; i < A; i++)
numbers[i] = i+1;
int i =0;
while (i<=A){
Total += numbers[i];
i++;
}
printf("Total =%d\n", Total);
return 0;
}
Submission
For this assignment, you need to write a report file of your work. The report should answer each question in details, providing outputs of the code to justify your answer.
In: Computer Science
“Pick any website that is interesting for you and choose two objects which are there. Write the part of code in how they are implementedFor example, I picked SEU website and I chose (Saudi Electronic University Copyrights) where is in the bottom of the first webpage. This is done by writing <footer> ...</footer> element”
In: Computer Science
Submit:
Be sure to:
Dog Walker Program
Programming language: Python
requirement: please follow up the rules per demonstrated.
In: Computer Science
Suppose we want to define an analogue of the IEEE 754 standard for 14 bits, with 1 bit for sign, 6 bits for (biased) exponent, and 7 bits for the significand. Assume exponent 000000 and 111111 are reserved for 0, denormal, NaN and infinity, just like IEEE 754 standard.
a) What is the bias for the exponent? Express it in decimal.
b) What is the smallest positive denormalized number?
c) What is the smallest positive normalized number?
d) What is the largest positive normalized number (excluding infinity)?
In: Computer Science
Create a rock paper scissors game against the computer using bunch of methods.
-No two dimensional arrays
-No java.util.random
-No ragged arrays
-Methods only, and one dimensional arrays
In: Computer Science
Problem Statement
In a restaurant, if you were pleased by the waiter's service, you may leave him a tip -- you pay him more than the actual value of the bill, and the waiter keeps the excess money. In some countries, not leaving a tip for the waiter is even considered impolite. During my recent holiday I was having dinner in a foreign restaurant. The pamphlet from my travel agency informed me that the proper way of tipping the waiter is the following:
Clearly, sometimes there may be multiple "correct" ways of settling the bill. I'd like to know exactly how many choices I have in a given situation. I could program it easily, but I was having a holiday... and so it's you who has to solve this task. You will be given:
Write a function that computes how many different final sums satisfy the conditions above.
Constraints
Examples
4 100 Returns: 0
4 isn't a round sum, and 5 is too much.
23 100 Returns: 1
The only correct choice is to pay 25 dollars, thus leaving a tip of 2 dollars.
23 24 Returns: 0The same bill, but I don't have enough money to leave an appropriate tip.
220 239 Returns: 1This time, it is appropriate to pay either 235 or 240 dollars. Sadly, I don't have enough money for the second possibility.
1234567 12345678 Returns: 14440A large bill, but with that much money I don't care.
1880000000 1980000000 Returns: 210527
171000000 179999999 Returns: 0
Given Function
int possible_payments(int bill, int cash) {
// fill in code here
}
Answer the problem statement by completing the
Given Function. Follow the constraints and
examples.
In: Computer Science
Write a python program.
The function protocol implements the functionality of the
diagnostic protocol. The main idea of this function is to call the
functions that you
have already implemented in the previous questions. See below for
an explanation of exactly what is
expected.
def protocol(my_symptoms: Tuple[Set],
all_patients_symptoms: Dict[str, Tuple[Set]],
all_patients_diagnostics: Dict[int, str]) -> str:
'''Return the diagnostic for my_symptoms based on the dictionary
of patients symptoms
(all_patients_symptoms) and the dictionary of patients
diagnostics
(all_patients_diagnostics).
Hint: This function selects the patients with the highest
similarity between the their
symptoms and my_symptoms (by calling the function
similarity_to_patients). Then, it
reports the the most frequent diagnostic from the patients with the
highest symptoms
similarity (by calling the function getting_diagnostics).
>>>protocol(yang, all_patients_symptoms,
all_patients_diagnostics)
'cold'
'''
In: Computer Science
Assume that the CES board of directors has asked you to examine
the ERP system implementation process. Please identify:
2.1. Business issues related to ERP system implementation;
2.2. Organizational issues related to ERP system implementation.
What would be the best practices for handling those issues?
In: Computer Science