Concept explainers
Pizza Slices
Joe's Pizza Palace needs a
A) Ask the user for the diameter of the pizza in inches.
B) Divide the diameter by 2 to get the radius.
C) Calculate the number of slices that may be taken from a pizza of that size if each slice has an area of 14.125 square inches.
D) Display a message telling the number of slices.
The number of square inches in the total pizza can be calculated with this formula:
Area=
Where variable r is the radius of the pizza and
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Starting Out with Java: Early Objects (6th Edition)
C Programming Language
Concepts of Programming Languages (11th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
- Joe’s Pizza Palace needs a program to calculate the number of slices a pizza of any size can be divided into. The program should perform the following steps: A) Ask the user for the diameter of the pizza in inches.B) Calculate the number of slices that may be taken from a pizza of that size if each slice has an area of 14.125 square inches.C) Display a message telling the number of slices.The number of square inches in the total pizza can be calculated with this formula:Area = πr2where variable r is the radius of the pizza and π is the Greek letter PI. In your program make PI a named constant with the value 3.14. Display the number of slices as a whole number (i.e., with no decimals).arrow_forwardSoftware Sales A software company sells a package that retails for $99. Quantity discounts are given below: Quantity Discount 10–19 20% 20–49 30% 50–99 40% 100 or more 50% Design a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.arrow_forwardOdd Even Number Problem Description Even Numbers are integers that are exactly divisible by 2, whereas an odd number cannot be exactly divided by 2. Example of even numbers are 2,4,6,8 and odd numbers are 1, 3, 5, 7, 9. Input The first line input contains an integer, which determines the number of test cases. Each of following lines represent sequence of integers that ends with 0. 2 34 1 8 5 22 0 10 7 16 -2 0 Output For each test case, the output will present the size of oddQueue and evenQueue following with the integers of odd and even numbers. oddQueue 2: 1 5 evenQueue 3: 34 8 22 oddQueue 1: 7 evenQueue 3: 10 16 -2 ** Your task is to write a program that will read the input and identify whether it is an odd number or even number. /******************************************************************************* Compilation: javac Queue.java** The Queue class represents a first-in-first-out (FIFO) queue of generic items.* It supports the usual enqueue and dequeue…arrow_forward
- Python code easy way pleasearrow_forwardParty-On sells individual hot/cold cups and dessert plates for parties. SueChen wants a program that allows her to enter the price of a cup, the price of a plate, the number of cups purchased, and the number of plates purchased. The program should then calculate the total cost of the purchase, including the sales tax. Finally, the program should display the total cost on the screen. Desk-check your solution’s algorithm using $0.50 as the cup price, $1 as the plate price, 35 as the number of cups, 35 as the number of plates, and 2% as the tax rate. Then desk-check it using $0.25, $0.75, 20, 10, and 6%.arrow_forwardComputer sciencearrow_forward
- An online book club awards points to its customers based on the number of books purchased each month. Points are awarded as follows: Books Purchased Points Earned 1 5 2 15 3 30 4 or more 60 Write a program that asks the user to enter the number of books purchased this month and then displays the number of points awarded.arrow_forwardMicrowaves / Radio Waves If a scientist knows the wavelength of an electromagnetic wave she can determine what type of radiation it is. Write a program that asks for the wavelength in meters of an electromagnetic wave and then displays what that wave is according to the following chart. (For example, a wave with a wavelength of 1E-10 meters would be an X-ray.) 1x 10-11 1 x 10-8 4 x 10-7 7x 10-7 1x 10-3 1 x 10-2 Gamma Rays. X Rays Ultraviolet Visible Light Infraredarrow_forwardflowchart and pseudocode in problem solving and logic A painting company has determined that for every 150 square feet of wall space, one gallon of paint and nine hours of labor will be required. The company charges $25.00 per hour for labor. If the size of the wall is more than 1500 square feet company will charge only $ 23.00 per hour of labor. Design a modular program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. Pass those parameters to the Module and perform all the calculations inside that module. Avoid using ref variables. Provide a unique name for the module Your program should display the following data: The number of gallons of paint required The hours of labor required The cost of the paint The labor charges The total cost of the paint jobarrow_forward
- Fat Percentage Calculator One gram of fat has 9 calories. If you know the number of fat grams in a particular food, you can use the following formula to calculate the number of calories that come from fat in that food: Calories from fat = Fat grams × 9 If you know the food’s total calories, you can use the following formula to calculate the percentage of calories from fat: Percentage of calories from fat = Calories from fat ÷ Total calories Create an application that allows the user to enter: • The total number of calories for a food item • The number of fat grams in that food item The application should calculate and display: • The number of calories from fat • The percentage of calories that come from fat Also, the application’s form should have a CheckBox that the user can check if he or she wants to know whether the food is considered low fat. (If the calories from fat are less than 30% of the total calories of the food, the food is considered low fat.) Use the following test data…arrow_forwardAreas of Rectangles The area of a rectangle is the rectangle's length times its width. Write a program that asks for the length and width of two rectangles. The program should tell the user which rectangle has the greater area, or if the areas are the same.arrow_forwardQustion number 3 using paython, please!arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT