Concept explainers
Exercises 43-50 refer to the following
Write Number2
Write a statement that supplies a suitable input prompt for the Input statements in Exercise 46.
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
PRELUDE TO PROGRAMMING (LL) >CUSTOM<
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Experiencing MIS
Digital Fundamentals (11th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- 25. Repeat Programming Exercise 24, but the wire is to be bent in the form of a circle. In this case, the user specifies the length of the wire and the program outputs the radius and area of the circle. (You may assume that . Also declare it as a named constant.)arrow_forward22. One metric ton is approximately 2,205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, a bag can hold. The program outputs the number of bags needed to store one metric ton of rice.arrow_forward26. A room has one door, two windows, and a built-in bookshelf and it needs to be painted. Suppose that one gallon of paint can paint 120 square feet. Write a program that prompts the user to input the lengths and widths of the door, each window, the bookshelf; and the length, width, and height of the room (in feet). The program outputs the amount of paint needed to paint the walls of the room.arrow_forward
- (Modify) a. Modify the program you wrote for Exercise 7 to provide the mass of a person as an output, given his or her weight as an input to the program. Use your program to determine the mass of a person who weighs 140 lbf on Earth. b. Modify the program written for Exercise 7a to also output the person’s weight on Mars and the moon. The pull of gravity on Mars is 12.54ft/sec2=3.728m/s2,andonthemoonis5.33ft/sec2=1.625m/s2.arrow_forward(Sum a Sequence of Integers) Write a program that sums a sequence of integers. Assume thatthe first integer read with scanf specifies the number of values remaining to be entered. Your program should read only one value each time scanf is executed. A typical input sequence might be5 100 200 300 400 500where the 5 indicates that the subsequent five values are to be summed.arrow_forwardExercise 2: Reverse positive numbersDisplay each positive integer in reverse order of its digits. The program shall process allentered positive numbers. However, it should stop if a non-positive number is entered. Notethat if the entered number is 1000 then you should display 0001. Hint: str(x) is a function that converts the integer value x to a string.Sample run:Enter a tve #: 10023 Revered #: 32001Enter a +ve #: 1000Revered #: 0001Enter a tve #: 9876Revered #: 6789Enter a tve #: -111arrow_forward
- Find the error in the code given below to print the message "Debugging Exercises." In the output. #include <stdio.h>int main(){ print "Debugging Exercises." return 0;}arrow_forwardcode MASM32 Function 1: calculate even numberInput a positive integer n and calculate the sum of even numbers between 0 and n and print the result.Function 2: check leap yearEnter a year and check if the year is a leap year and print the result. A leap year is a year that is divisible by 400 or divisible by 4 but not divisible by 100. Call 2 functions into the main program, compile and run test resultsarrow_forwardUse this table to convert digits to barcode representation and vice-versa; each digit is represented in 5 characters; so 1 will be represented as 00011; as 0 is represented as half bar (:) and 1 is a full bar (1) ; 1 will be represented as :::|| ; similarly 9 is 10100 and will be represented as |:|:: Write a program that asks the user for a ZIP code and prints the bar code. Use : for half bars, | for full bars. For example, 95014 becomes ||:|:::|:|:||::::::||:|::|:::||| Your program should also be able to carry out the opposite conversion: Translate bars into their ZIP code, reporting any errors in the input format or a mismatch of the digits. javaarrow_forward
- The Salary Program: Modify the program from the textbook (Program 1-1,see below) which reads the number of hours an employee works reads the pay rate per hour computes the pay for the employee. Add the following steps: a) Read an amount of bonus paid to the employee.b) Compute the total pay as pay plus bonus.c) Compute the tax at 30% of the total pay.d) Compute the net pay as total pay minus tax, and e) Print a report showing: total pay, tax deduction, and net pay. Algorithm: 1. Prompt the user for number of hours.2. Read the value for hours.3. Prompt the user for hourly rate.4. Read the hourly rate.5. Prompt the user for amount of bonus.6. Read the value for bonus.7. Compute the pay.8. Compute the totalPay by adding bonus to pay.9. Compute the tax deduction by multiplying 30% times totalPay.10. Compute the netPay by subtracting tax from totalPay.11. Neatly print and label the following: a. totalPay b. tax c. netPay Put your…arrow_forwardreate an enumeration named Planet that holds the names for the eight planets in our solar system, starting with MERCURY equal to 1 and ending with NEPTUNE. Write a program named Planets that prompts the user for a numeric position, and display the name of the planet that is in the requested position. In C#arrow_forward5-1) (Count positive and negative numbers and compute the average of numbers) Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning