EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
8th Edition
ISBN: 9780357425299
Author: Malik
Publisher: CENGAGE CO
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 2, Problem 5PE
Program Plan Intro
Correction to the sequence of the statements in a program
Program Plan:
Correct the sequence of statements in the given program which accomplishes the following:
it prompts the user to input the radius of a circle and outputs the area and circumference of the circle
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
C++
Programing Language: C++
Your time machine is capable of going forward in time up to 24 hours. The machine is configured to jump ahead in minutes. To enter the proper number of minutes into your machine, you would like a program that can take a start time (in hours, minutes, and a Boolean indicating AM or PM) and a future time (in hours, minutes, and a Boolean indicating AM or PM) and calculate the difference in minutes between the start and future time.
A time is specified in your program with three variables:
int hours, minutes;
bool isAM; // You can also use a char, i.e. A or P
for example, to represent 11:50 PM, you would store:
hours = 11,minutes = 50, isAM = false or if using a char, hours = 11,minutes = 50, isAM = 'A'
This means that you need six variables to store a start and future time.
Write a program that allows the user to enter a start time and a future time. Include a function named computeDifference that takes the six variables as parameters that represent the start…
Using c++ write a program
: Write a program in C++ to handle the following scenario: Three friends Asif, Shahid and Bashir start the business. Input following from user.
Enter amount invested by Asif (user will enter any value)
Bashir’s contribution is equal to 250% of Asif’s contribution and Shahid’s contribution is equal to 75% of Bashir’s contribution. Display amount contributed by Bashir and Shahid. After 6 months business earned profit of 50% of total investment. Display the total profit and the amount each sharer will get (i.e. distribute profit as per percentage of their investment).
Chapter 2 Solutions
EP MINDTAPV2.0 FOR MALIK'S C++ PROGRAMM
Ch. 2 - 1. Mark the following statements as true or...Ch. 2 - Prob. 2MCCh. 2 - Which of the following is not a reserved word in...Ch. 2 - Prob. 4SACh. 2 - 5. Are the identifiers quizNo1 and quiznol the...Ch. 2 - 6. Evaluate the following expressions. (3,...Ch. 2 - If int x = 10;, int y = 7;, double z = 4.5;, and...Ch. 2 - Prob. 8CPCh. 2 - 9. Suppose that x, y, z, and w are int variables....Ch. 2 - Prob. 10SA
Ch. 2 - Which of the following are valid C++ assignment...Ch. 2 - Write C++ statements that accomplish the...Ch. 2 - Write each of the following as a C++ expression....Ch. 2 - Prob. 14SACh. 2 - Suppose x, y, and z are int variables and wandt...Ch. 2 - 16. Suppose x, y, and z are int variables and x =...Ch. 2 - Suppose a and b are int variables, c is a double...Ch. 2 - 18. Write C++ statements that accomplish the...Ch. 2 - Which of the following are correct C++ statements?...Ch. 2 - Give meaningful identifiers for the following...Ch. 2 - 21. Write C++ statements to do the following....Ch. 2 - Prob. 22SACh. 2 - The following program has syntax errors. Correct...Ch. 2 - Prob. 24SACh. 2 - Prob. 25SACh. 2 - Preprocessor directives begin with which of the...Ch. 2 - 27. Write equivalent compound statements if...Ch. 2 - 28. Write the following compound statements as...Ch. 2 - 29. Suppose a, b, and c are int variables and a =...Ch. 2 - Suppose a, b, and sum are int variables and c is a...Ch. 2 - Prob. 31SACh. 2 - Prob. 32SACh. 2 - Prob. 33SACh. 2 - Prob. 34SACh. 2 - 1. Write a program that produces the following...Ch. 2 - Prob. 2PECh. 2 - Prob. 3PECh. 2 - 4. Repeat Programming Exercise 3 by declaring...Ch. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - 7. Write a program that prompts the user to input...Ch. 2 - Prob. 8PECh. 2 - 9. Write a program that prompts the user to enter...Ch. 2 - 10. Write a program that prompts the user to input...Ch. 2 - 11. Write a program that prompts the capacity, in...Ch. 2 - 12. Write a C++ program that prompts the user to...Ch. 2 - 13. To make a profit, a local store marks up the...Ch. 2 - 14. (Hard drive storage capacity) If you buy a 40...Ch. 2 - 15. Write a program to implement and test the...Ch. 2 - 16. A milk carton can hold 3.78 liters of milk....Ch. 2 - 17. Redo Programming Exercise 16 so that the user...Ch. 2 - Prob. 18PECh. 2 - 19. Write a program that prompts the user to input...Ch. 2 - 20. For each used car a salesperson sells, the...Ch. 2 - 21. Newton's law states that the force, , between...Ch. 2 - 22. One metric ton is approximately 2,205 pounds....Ch. 2 - 23. Cindy uses the services of a brokerage firm to...Ch. 2 - 24. A piece of wire is to be bent in the form of a...Ch. 2 - 25. Repeat Programming Exercise 24, but the wire...Ch. 2 - 26. A room has one door, two windows, and a...Ch. 2 - Prob. 27PECh. 2 - 28. In an elementary school, a mixture of equal...Ch. 2 - 29. A contractor orders, say, 30 cubic yards of...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In C programming language, if the first and the second operands of operator + are of types int and float, respectively, the result will be of type A. int B. float C. char D. long intarrow_forwardb) Given the following function in C++ language. i. 10 20 30 40 50 60 70 80 90 100 void ValveControl (int pressure, int temperature) { if (pressure >=100) { } else { OpenTheValve(); cout 27) { EnableCoolingCoil(); cout<<"Cooling coil enabled\n"; Define the valid and invalid equivalence partition for all possible test case(s) and TWO (2) example data for each partition.arrow_forwardNote: avoid plagiarism make it differentarrow_forward
- 2:10 AM 58 Litie Write a C++ program to simulate the tasks of a vending machine. The machine accepts only coins from the customer. Initially, it displays the following message on screen: "Please insert coins". When a customer inserts a coin, the machine asks the him/her to select a drink (if the coins are enough) through entering its code. If the money inserted is enough, the machine will prepare the drink telling the customer that the drink is ready. It also calculates the cost of the drink and asks the customer if he wants another drink or wants to exit. If the remaining coins are enough, the same procedure applies when the customer asks for a new drink. Else, the machine displays the following message: "Not enough coins, Please insert coins, or "C" to exit". If the user presses "C", the machine returns the coins/ change to the user and displays the message "Please insert coins". hint You just use lostream library and for loop ...arrow_forwardPROBLEM: Write a C++ program that will allow the user to input the First Name, Last name, Middle Initial, and grade of a student. The following conditions must be observed: If the grade input is 96-100, the remark is " you performed an excellent job! Keep it up !" If the grade input is 91-95, the remark is " you performed a very satisfactory Job! Keep it up !" If the grade input is 86-90, the remark is " you have satisfactory performance, you can improve some more. " If the grade input is 80-85, the remark is " your performance is fair, try harder" If the grade input is 75-79, the remark is " your performance needs Improvement, you can do it" If the grade input is below 75, the remark is " we're sorry but you failed, we know you can do better next time" а. b. c. d. е. f. SPECIFICATIONS that you need to follow: - You may only use the codes that we studied under our lectures. - All lines of codes should have a comment. - Save and Submit your cpp file as Surname - PE (Example: Pangaliman…arrow_forwardFundamentals of Programming in C Language Write the value of each of the following expressions, using the following data declarations: double m = 17.5; int y = 9; 1. (m > 12.0) && (y / 2 <= 4) 2. (y % 3 != 0) 3. (m < 2 * y) 4. (2 == 3) || (m - 16 >= 0)arrow_forward
- C++ Demonstration: Write a program that computes the equivalent resistance of a purely series and purely parallel electric circuit. TEST CASES: If the user inputs a character: Computing for the equivalent resistance A. Series CombinationB. Parallel Combination Enter Choice: B Enter R1: 1 Enter R2: 2 Enter R3: A The value of R3 is not a number. If the user selects “Series Combination” and inputs numbers: Computing for the equivalent resistance A. Series Combination B. Parallel Combination Enter Choice: A Enter R1: 1 Enter R2: 2 Enter R3: 3 The total resistance in series is 6 Ohms.arrow_forwardWrite in C++arrow_forward# Python 3 def printFunction(num1, num2): num3 = num1 + num2 return num3print(num3) Explanation: Here, num3 is the local variable that is defined in the scope of the function and when it is used outside the function, an error occurs. Print(num3) is the statement which is outside the scope of the function. So, when this statement is executed, there is no variable named num3 to be printed, so it gives an error. The error that occurs is : NameError: name 'num3' is not defined Construct a function that takes an argument. Give the function parameter a unique name. Show what happens when you try to use that parameter name outside the function. Explain the results. Show what happens when a variable defined outside a function has the same name as a local variable inside a function. Explain what happens to the value of each variable as the program runs.arrow_forward
- Write a C++ program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. **DO NOT USE AN ARRAY OR GLOBAL VARIABLES!!!*** YOU MUST USE THE STATED FUNCTIONS. AND INPUT VALIDATION. For FULL CREDIT DISPLAY THE LOWEST SCORE WITH GOOD OUTPUT DESCRIPTION you MUST USE function prototyping.. DO NOT ACCEPT SCORES LESS THAN 0 OR GREATER THAN…arrow_forwardThe C program shown below is for calculating the area of a circle with a radius of 2.5. However, there is a missing C statement in the program. Which of the following is the correct statement to complete the program? // Insert missing C statement here float calculateArea(float r) { float circle_area; circle_area = PI*r*r; return (circle_area); } void main(void) { float area; area = calculateArea (2.5); } O #define PI 3.1415 #include PI 3.1415; #define PI 3.1415; #include PI 3.1415arrow_forwardIn C Languagearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr