Concept explainers
How Many Pizzas?
Modify the program you wrote in
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Mechanics of Materials (10th Edition)
Starting Out with Python (4th Edition)
SURVEY OF OPERATING SYSTEMS
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Concepts Of Programming Languages
- (Simulation) Write a program to simulate the roll of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like, with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with the expression dots=(int)(6.0randomnumber+1), where the random number is between 0 and 1.)arrow_forwardAssignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: YOU MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450 804.18 776.2 -1…arrow_forwardAssignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: You MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output Answer assignment 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450…arrow_forward
- SOLVE IN C# Canada Government has announced 250 immigration visa lottery for third world countries. Total number of Application collected 10000, starting from application number 1 to 10000. You are required to write a program for Canadian government to select 250 visa for lottery visa, randomly from the pool of 10000 application and print the application number on screen Note: No input required in this programarrow_forwardASSIGNMENT: You are working for a lumber company, and your employer would like a program that calculates the cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber. Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. The price per board foot is given in the following table: Pine 0.89 Fir 1.09 Cedar 2.26 Maple 4.50 Oak 3.10 The lumber is sold in different dimensions (specified in inches of width and height, and feet of length) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which when divided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and four integer numbers. The integers are the number of pieces, width, height, and length. The letter will be one of P, F, C, M, O (corresponding to the five kinds of wood) or T, meaning total. When the letter is T,…arrow_forwardBob a builder has come to you to build a program for his construction business. He needs to determine the square footage of a room in order to buy material and calculate costs.Bob charges $425 per square metre.the program is going to ask the user to enter the name of a room . It will then ask you for the width and length of a room (in metres) to be built.the program will calculate the room area and use this information to generate an approximate cost. Your program will display the room , the total area and the approximate cost to the screenarrow_forward
- hello i need to write a java program A car insurance company charges a base fee of BD 50 per year, plus the following fees for any accident: Fees Number of checks BD 20 for each accident Less than 3. BD 50 for each accident From 3 to 4. BD 75 for each accident More than 4 Write a program that asks for the number of accidents for the year . The program should then calculate and display the insurance company fees for the year. If number of accidents less than zero, print an invalid message and quit the program.arrow_forwardThis code when ran asks for job code and then hours worked, but when I put in 20 or 40 hours I get an error... indexerror: Tuple index out of range Its supposed to be for up to 40 hours, no more then that.. how do I fix the tuple range? # Name: Erica Strong # Prog Purpose: This program computes employee weekly pay # Category codes: # C Cashier: $16.50 # S Stocker: $15.75 # J Janitor: $15.75 # M Maintenance: $19.50 import datetime # define pay rates & deduction rates PAY_RATES = (16.50, 15.75, 15.75, 19.50) DEDUCTION_RATES = (0.12, 0.03, 0.062, 0.0145) # define global variables inout = 'C' # C means Cashier, S means Stocker, J means Janitor, M means Maintenance hoursworked= 0 payrates = 0 deductionrates = 0 grosspay = 0 netpay = 0 ############ Define program functions ############ def main(): another_employee = True while another_employee: hours_worked, job_code = get_user_data() gross_pay = perform_calculations(hours_worked, job_code) total_deductions, deductions =…arrow_forwardThe BlueMont chain hotels have 4 different types of room: Single room: $60/night Double room: $75/night King room: $100/night Suite room: $150/night The size of the hotel chains in different locations may be different in terms of the number of floors and the type and the number of rooms on each floor. You are required to write a program that calculates the occupancy rate and the total hotel income for one night and displays this information as well as some other information described below. The program starts by asking the location where this hotel chain is located and the number of floors in the hotel. The number of floors may not exceed 5. The User then enters the total number of rooms for each floor. The program then asks specifically the number of occupied rooms for each room type on this floor. The total number of rooms on each floor may not exceed 30 and the program should check that the total number of occupied rooms on each floor does not exceed the total of rooms on…arrow_forward
- Box Office: A movie theater only keeps a percentage (20%) of the revenue earned from ticket sales. The remainder goes to the movie distributor. Write a program that calculates a theater’s gross and net box office profit for a night. The program should ask for the name of the movie, and how many adult and child tickets were sold. (The price of an adult ticket is $10.00 and a child’s ticket is $6.00.) Input: the name of the movie, number of adult tickets sold, number of child tickets sold Output: as specified below Object: cin, cout, getline, format output Note: 1. Movie names contain spaces 2, the report is aligned. 3. The decimal number is displayed with 2 decimal places.arrow_forwardProgram by using C # C sharp My student number :1910206534arrow_forward# given a radius, find the area of a circle # use value of pi as 3.1415 def get_area_circle(r): """ what it takes radius of a circle (any positive real number) what it does: computes the area of a circle given a radius, find the area of a circle area = pi*r2 (pi times r squared) what it returns area of a circle. Any positive real number (float) """ # your code goes in herearrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT