Concept explainers
Write a
How many exercises to input? 3
Score received for exercise 1: 10
Total points possible for exercise 1: 10
Score received for exercise 2: 7
Total points possible for exercise 2: 12
Score received for exercise 3: 5
Total points possible for exercise 3: 8
Your total is 22 out of 30, or 73.33%.
Trending nowThis is a popular solution!
Chapter 2 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Computer Science: An Overview (12th Edition)
Absolute Java (6th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
C Programming Language
Java How To Program (Early Objects)
- Statistics are often calculated with varying amounts of input data. Write a program that prompts for and takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Example program run (the user types only the numbers, in this case 15 20 0 5 -1): Enter numbers separated by spaces, with a negative number to quit: 15 20 0 5 -1 Average = 10 Max = 20 #include <iostream>using namespace std;/* program that prompts for and takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Example program run (the user types only the numbers, in this case 15 20 0 5 -1): Enter numbers separated by spaces, with a negative number to quit:15 20 0 5 -1 Average = 10 Max = 20*/ int main() { /* Type your code here. */ return 0;}arrow_forwardAt a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and the late submission time (in minutes), and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes): 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0 Sample Run 4: Enter your initial grade: 72 Enter the late submission time (in minutes): -2 Time should be positivearrow_forwardAt a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and the late submission time (in minutes), and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes): 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0arrow_forward
- Write a program that reads from the user the registration fees, number of credits required for a student to finish the course, the credit price, and the number of years the student is planning to finish the whole track. The program should calculate the cost to be paid by the user each year. Payment = (credit price X number of credits)/ years + registration fees The below Sample Run is to calculate the yearly payment of a course having 60 credits, 250$ for credit, 100$ for registrations fees each year, and 3 years to finish the track: Sample Run: Please enter registration fees, credit price, number of credits, and number of years: 100 250 60 3 The yearly required payment is: $5100.0arrow_forwardWrite a program that reads from the user the registration fees, number of credits required for a student to finish the course, the credit price, and the number of years the student is planning to finish the whole track. The program should calculate the cost to be paid by the user each year. Payment = (credit price X number of credits) / years + registration fees The below Sample Run is to calculate the yearly payment of a course having 60 credits, 250$ for credit, 100$ for registrations fees each year, and 3 years to finish the track: using java Sample Run: Please enter registration fees, credit price, number of credits, and number of years: 100 250 60 3 The yearly required payment is: $5100.0arrow_forwardThe Café Noir Coffee Shop wants some market research on its customers. When a customer places an order, a clerk asks for the customer’s zip code and age. The clerk enters that data as well as the number of items the customer orders. The program operates continuously until the clerk enters a 0 for zip code at the end of the day. When the clerk enters an invalid zip code (more than 5 digits) or an invalid age (defined as less than 10 or more than 110), the program reprompts the clerk continuously. When the clerk enters fewer than 1 or more than 12 items, the program reprompts the clerk two more times. If the clerk enters a high value on the third attempt, the program accepts the high value, but if the clerk enters a negative value onthe third attempt, an error message is displayed and the order is not counted. At the end of the program, display a count of the number of items ordered by customers from the same zip code as the coffee shop (54984), and a count from other zip codes. Also…arrow_forward
- Write a program that will take as input the type of restaurant the user ate at, the cost of the meal, the number of people in his/her party, and how good the service was. Determine the dollar amount of thetip:Base Tip:Diner: 12%Good Restaurant: 15%Fancy Restaurant: 20%Additions/Subtractions:Poor Service: -2%Good Service: +0%Excellent Service: +2%1-5 in party: +0%6-10 in party: +3%more than 10: +5%arrow_forwardWrite a program that helps a company manage salaries of its employees. Your program should ask for the number of hours worked and the hourly rate of an employee than, display the salary. This program should allow the user to enter the information of many employees until enters -1. Sample Run: Enter the number of hours worked (-1 to end): 32 Enter hourly rate of the worker: 100 Balary is 03200 Enter the number of hours Worked (-1 to end) : 40 Enter hourly rate of the worker: 5 Balary is 3200 Enter the number of hours worked (-1 to end): 42 Enter hourly rate of the worker: 10 Salary is 0420 Enter the number of hours worked (-1 to end) : -1arrow_forwardWrite a program that takes the distance of the commute in kilometers, the car fuel consumption rate in kilemeter per gallon, and the price of a gallon of petrol as input. The program should then display the cost of the commute. The program will then display all the information needed as shown in the sample run below Sample Run: Enter distance of commute in kms: 150 Enter fuel consumption rate: 11 Enter price of petrol: 85 Cost of commute = 1159.0909arrow_forward
- Write a program that takes the distance of the commute in kilometers, the car fuel consumption rate in kilometer per gallon, and the price of a gallon of petrol as input. The program should then display the cost of the commute. The program will then display all the information needed as shown in the sample run below Sample Run: Enter distance of commute in kms: 150 Enter fuel consumption rate: 11 Enter price of petrol: 85 Cost of commute = 1159.0909arrow_forwardWrite a program that helps a company manage salaries of its employees. Your program should ask for the number of hours worked and the hourly rate of an employee than, display the salary. This program still asks the user to enter the information of many employees until enters a zero value. Sample Run: Enter the number of hours worked (negative nbr to end): 32 Enter hourly rate of the worker: 100 Your salary is $3200 Enter the number of hours worked (negative nbr to end): 40 Enter hourly rate of the worker: 5 Your salary is $200 Enter the number of hours worked (negative nbr to end): 42 Enter hourly rate of the worker: 10 Your salary is 5420 Enter the number of hours worked (negative nbr to end): 0arrow_forwardGiven the sample code above in generating a random number. Create a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu if you prefer.) 13. The computer's choice is displayed. 4. A winner is selected according to the following rules: a. If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.) b. If one player chooses scissors and the other player chooses paper, then scissor wins. (Scissors cuts paper.) c. If one player chooses paper and the other player…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education