Questions: 11 448

Answers by our Experts: 10 707

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Kamal would like to withdraw X Rs from an ATM. The cash machine will

only accept the transaction if X is a multiple of 100, and kamal's account balance has enough cash to

perform the withdrawal transaction. For each

successful withdrawal the bank charges 50 Rs. Calculate Kamal's account

balance after an attempted transaction.


Consider the definition of the following class:

class Sample

{

private:

  int x;

  double y;

public :

  Sample();

//Constructor 1

  Sample(int);

//Constructor 2

  Sample(int, int);

//Constructor 3

  Sample(int, double);

//Constructor 4

};


i. Write the

definition of the constructor 1 so that the private member variables are initialized

to 0.

ii. Write the

definition of the constructor 2 so that the private member variable x is

initialized according to the value of the parameter, and the private member

variable y is initialized to 0.

iii. Write the definition of the constructors 3 and 4 so that the private

member variables are initialized according to the values of the parameters


Consider the class declaration and main() function below. There are two errors in

the main() function. Name the errors and explain how to fix them, providing all the

code required to correct the errors.

class Game

{

public:

Game();

string getName();

int getLevel();

double getScore();

private:

string Name;

string Champion;

int Level

double Score;

};

int main()

{

Game sodoku, tetris[12];

.........(additional code)

double nScore = sodoku.Champion;

.........(additional code)

return 0;

cout << "The first tetris player is "

<< tetris.getName() << endl;

}


A book shop maintains the inventory of books that are being sold at their shop. The list includes details such as author, title, price, publisher and stock position. Whenever a customer wants a book, the sales person inputs the title and author and the system searches the list and displays whether it is available or not. If it is not, an appropriate message is displayed. If it is, then the system displays the book details and requests for the number of copies required. If the requested copies are available, the total cost of the requested copies is displayed; otherwise "Required copies not in stock" is displayed. Design a

system using a class called books with suitable member functions and constructors. Use new operator in constructors to allocate memory space required.

The science museum has asked you to write a c++ application that children can use to find the total number of hours and years slept during their lifetime. Assume they slept at an average of 8 hour per night. The user should enter the name, birthday, year and current year.

Name - Mercy

day - 01

year - 1999

Current year - 2021


To calculate the number of hours slept. Assume 365 day per year, 30 day per month and 8 hours of sleep per day. The program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime.

Note : use classes, function, and control structures to achieve this task. the user will also determine the number of children the process.


the science museum has asked you to write a c++ application that children can use to find the total number of hours and years slept during their lifetime. assume they slept at an average of 8 hour per night. the user should enter the name, birthday, year and current year. to calculate the number of hours slept. 365 day per year, 30 day per month and 8 hours of sleep per day. the program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime. note use classes, function, and control structures to achieve this task. the user will also determine the number of children the process


The MUSEUM has asked you to write a C++ applicationt that children can use to find the total number of hours and years slept during their lifetime. Assume they slept at an average of 8 hour per night. the user should enter the name, birthday, year and current year. To calculate the number of hours slept. 365 day per year, 30 day per month and 8 hours of sleep per day. The program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime


How we can access the private and protected members of class in other class or function without using inheritance. Write Example of Weight class which has two private data members kg and gram.There is a nonmember function AddTen() which object of weight class and adds the values ten to kg and gram.


Create a file called "DATA" to store the set of integer elements. Search whether the given element is present or not within the file. If the element is present, then write the factors of that searching element in the "FACTORS" file. Write a formatted IO file program to demonstrate the above operation and display the contents of "FACTORS" file.
Create a class called Person that has three private data members name, age and height and the

following public member functions: • Default constructor - To initialize the data members

Parameterized constructor - To initialize it to the given values

.getInput() - To get the person details from the user showOutput() A constant member function to display the person details. Names.

should be left justified and age and height to be right justified

isTaller() - A constant member function that takes a constant person object as parameter and compares the height of the person object which calls this function with the height of the person object that is passed as parameter and returns true if the calling object is taller than passed argument; otherwise returns false; Write a main function to create an array of 3 Person objects and find the tallest person. Display all the persons details and print the details of the tallest person.
LATEST TUTORIALS
APPROVED BY CLIENTS