• Write a function called by main() named guessNumber that does not take any arguments but returns a number in the range from 0 to 99. This function validates the range of the guessed number. This function is repeatedly called until the guess is within the range from 0-99. This function calls the following function to get an integer value.
• Write a function called by guessNumber() named getInt that takes one argument of type string. It is a prompt to get number from the user. This function returns an integer. This function handles the nonnumerical input. 1
• Finally write the main() function where the game is played. The main Creates the random number from 0 to 99. guess outside the loop. It calls the guessNumber() function for the number guessed and stores it in an int variable called guess. The loop runs as long as the guess is not equal to the computer generated random number.
Let us consider a guessing game in which the computer picks a random two- digit number in the range from 0 to 99 and asks the user to guess the number. After each guess, the computer lets the player know how many digits of guessed numbers match the correct number. If the guessed number matches the correct number, the computer lets the player know the number of guesses the player made.The goal of testing is to make the function fail as soon as possible so that, you can correct it immediately. Please do not use strings int his program. You should be able to do digit matches perfectly without using a string. The following is the example log of the execution:
Try to guess my number form 0 - 99 and I will tell you how many digits of your guess match my number. Your guess?
50 Incorrect (hint: 0 digits match)
your guess?
73 Incorrect (hint: 0 digits match)
Your guess?
yes That’s not an integer. Try again
Your guess?
79 Incorrect (hint: 0 digits match)
Your guess?
300 Invalid number. Try again!
Your guess?
34 Incorrect (hint: one digit matches)
Your guess?
36 Incorrect (hint: 0 digits match)
Your guess?
48 Incorrect (hint: 2 digits match)
Your guess?
84 Congratulations! You took 9 guesses
Implement a class Matrix as defined below. class Matrix { public: Matrix(); //create a matrix of size 2X2 Matrix(int r,int c); // create a matrix with r rows and c columns Matrix(const Matrix & m); //copy constructor , create a deep copy of //matrix m Matrix operator+(const Matrix &); Matrix operator-(const Matrix &); Matrix operator*(const Matrix &); bool operator==(const Matrix &); bool operator!=(const Matrix &); Friend ostream& operator<<(ostream& ,Matrix &); Friend istream& operator>>(istream& ,Matrix &); bool isIdentity(); //returns true if matrix is identity matrix 3 | P a g e void transpose(); //transpose of matrix void inverse(); // inverse of matrix void adjoint(); //adjoint of matrix int getElement(int r,int c); // returns element at row r and col c int determinant(); //find the determinant void fillMatrix(); // fill matrix by taking input from user void print(); ~Matrix(); private: int ** data; int rows; int cols; };
A worker takes a job for 5 days. His pay for the day 1 is Rs. X, for day 2 is Rs. 2X and so on. Develop a C program to find the total salary.
Husna Dental is a personal dental clinic that recently operated on 1st January 2015. The payment for dentistry services at Husna Dental is different based on the type of treatment and patient status.
Restoration(1). Extraction(2) Scaling(3)
Children(C) RM6.00 RM15.50 RM4.00
Adult(A) RM7.50 RM18.00 RM5.00
the discount of 20% will be given for children’s treatment and 15% discount for adult’s treatment.
Write a C++ program that performs the following.
· · · ·
a) Reads the patient's name, patient status, and type of treatment.
b) Displays the appropriate message when the user enters an invalid status.
c) Calculates the payment before and after discount.
d) At the end of the program, displays receipt that contain patient’s name and her/his total payment after discount.
Task 1
Create a class named Ticket that represents the ticket to access a museum. The class has a constructor that takes in input a number representing the base value of the ticket. Moreover, the class has a method named "calcTicketCost(int)". The total cost of the ticket depends on the base ticket value and the number of visitors (normally, number of visitors x base value).
Create a class StudentTicket that inherits from the class Ticket and re-implement the method calcTicketCost(int) by shaping a different logic to the class such as: a discount of 40% is applied to the total ticket price.
Task 2
Create an abstract class named Ticket that represents the ticket to access a museum. The class has a constructor that takes in input a number representing the base value of the ticket
Moreover, the class has an abstract method named "calcTicketCost(int)".
In addition, create two classes, respectively named
NormalTicket and Student Ticket that inherit from the class Ticket and implement the missing abstract method calcTicketCost(int). The total cost of the ticket depends on the base ticket value and the number of visitors (normally, number of visitors x base value).
For the normal ticket the following discounts are applied: 1 to 3 visitors, no discount 4 to 7 visitors, 10% 8 to 10 visitors, 15% .More than 10, 20%
For the student ticket there is a flat discount of 40% regardless of the number of visitors.
Part 1
Encapsulate the following Python code from Section 7.5 in a function named my_sqrt that takes a as a parameter, chooses a starting value for x, and returns an estimate of the square root of a.
while True:
y = (x + a/x) / 2.0
if y == x:
break
x = y
Part 2
Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a).
create page that . Has the functionality to upload pictures and a description of the picture. Use HTML, PHP, or JavaScript. Please show the database SQL code