C++ Answers

Questions answered by Experts: 9 913

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

Create a class static demo with static member function for following function:


1)find factorial by recursive member function.


2)to check whether a number is prime or not






. Use (Switch case) command.



HINT: you have to set some drinks and set them some valid values that should not exceed



more then 1$ (Avoid Negative values)



Requirements:



Following are the requirements for the above discussed problem:



a. Vending Machine must keep track of the inventory



b. A person should be able to insert cash into the machine & choose an item



c. The Machine should confirm the inserted cash with the price of the selected item



d. The machine must display an error in case of insufficient cash or unavailable item



e. Finally, if all the above steps succeed then the user gets the selected item

Write a program that calculates and displays a person’s body mass index (BMI). The BMI


is often used to determine whether a person with sedentary lifestyle is overweight or


underweight for his or her height. A person’s BMI is calculated with the following formula:


BMI = weight * 703/height2


where weight is measured in pounds and height is measured in inches. The program


should display a message indicating whether the person has optimal weight, is


underweight, or is overweight. A sedentary person’s weight is considered to be optimal


if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is


considered to be underweight. If the BMI value is greater than 25, the person is


considered to be overweight. Use functions for this program. Implement those functions


in a separate header file.

An automobile travels at an average speed of 55 miles per hour for four hours. Draw a flowchart, write an algorithm and design a C++ program that computes and displays the distance driven, in miles that the car has travelled after 0.5, 1.0, 1.5 hours, and so on until the end of the trip.


A machine purchased for P28,000 is depreciated at a rate of P4,000 for seven years. Draw a flowchart, write an algorithm and design a C++ program that computes and displays in a suitably sized list box a depreciation table for seven years.



Draw a flowchart, write an algorithm and design a C++ program for an inventory system that will alert the user to reorder an item based on:

a.     The stock-on-hand or an order is below the reorder print.

b.     The item is not obsolete.

Use the selection structure.


A parameterized constructor taking 4 arguments for bread slices, cheese slices, meat patty number and tomato slices. The values of the rest of the variables will be initialized by default to true 2. Another parameterized constructor that takes argument for each of these variables and initializes them accordingly 3. Another parameterized constructor that takes argument for each of these variables and initializes them accordingly 4. Provide setters for mustard, ketchup, iceberg and gilled 5. Provide getters for each of these variables 6. Provide a method calculatePrice() that calculates and returns the price of this sandwich according to the rates given in the above table. E.g. the price of a sandwich with 3 bread slices, 2 cheese slices, 2 tomato slices, 3 patties, mustard, no ketchup, no ice berg with grilling will be calculated as 3 * 20 + 2 * 30 + 2 * 5 + 3 * 70 + 5+ 0 + 0 + 10  


Using a for loop, write a programme that prints all values between 20 and 24. Then using an if-else statement and the modulus operator, modify your program to add the word "odd" or "even" to each value to show if it is odd or even.


Expected Output:


20-even


21-odd


22-even


23-odd


24-even


Convert the following FOR statement to WHILE statement: (5 MARKS)



#include <iostream>



using namespace std; #include <iostream>



using namespace std;



int main()



{



for (int counter = 1; counter <= 10; counter++)



cout << “Counter is: ” << counter << endl;



return 0;



}

Suppose m and r are integers. Write two different ways of C++ expression for mr2,store the result to variable result. The other expression uses the math function for r2 and the other doesn’t use the math



function but the equivalent expression

LATEST TUTORIALS
APPROVED BY CLIENTS