Joe's Pizza Palace needs an application to calculate the number of slices a pizza of any size can be divided into. The application should do the following:
- a. Allow the user to enter the diameter of the pizza, in inches.
- b. Calculate the number of slices that can be cut from a pizza that size.
- c. Display a message that indicates the number of slices.
To calculate the number of slices that can be cut from the pizza, you must know the following facts:
- a. Each slice should have an area of 14.125 inches.
- b. To calculate the number of slices, divide the area of the pizza by 14.125.
The area of the pizza is calculated with the following formula:
Area = πr2
Note
π is the Greek letter pi. 3.14159 can be used as its value. The variable r is the radius of the pizza. Divide the diameter by 2 to get the radius.
If the user fails to enter numeric values, display an appropriate error message and do not attempt to perform calculations. Use the following test data to determine if the application is calculating properly:
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Starting Out With Visual Basic (7th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++: Early Objects
Starting Out with Python (3rd Edition)
Experiencing MIS
Artificial Intelligence: A Modern Approach
Computer Systems: A Programmer's Perspective (3rd Edition)
- Account numbers sometimes contain a check digit that is the result of a mathematical calculation. The inclusion of the digit in an account number helps ascertain whether the number is a valid one. Write an application named CheckDigit that asks a user to enter a four-digit account number and determines whether it is a valid number. The number is valid if the fourth digit is the remainder when the number represented by the first three digits of the four-digit number is divided by 7. For example, 7770 is valid, because 0 is the remainder when 777 is divided by 7. The next problems rely on the generation of a random number. You can create a random number that is at least mi n but less than max using the following statements: Random ranNumberCenerator = new Random(); int randomNumber; randomNumber = ranNumberGenerator .Next(min, max);arrow_forwardCarpet Calculator The Westfield Carpet Company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To calculate the price, you multiply the area of the floor (width times length) by the price per square foot of carpet. For example, the area of floor that is 12 feet long and 10 feet wide is 120 square feet. To cover that floor with carpet that costs $8 per square foot would cost $960. First, you should create a class named RoomDimension that has two fields: one for the length of the room and one for the width. The RoomDimension class should have a method that returns the area of the room. (The area of the room is the room’s length multiplied by the room’s width.) Next you should create a RoomCarpet class that has a RoomDimension object as a field. It should also have a field for the cost of the carpet per square foot. The RoomCarpet class should have a method that returns the total cost of the carpet. Figure 8-20 is a UML…arrow_forwardProperty Tax If you own real estate in a particular county, the property tax that you owe each year is calculated as 64 cents per $100 of the property’s value. For example, if the property’s value is $10,000, then the property tax is calculated as follows: Tax = $10,000 ÷ 100 × 0.64 Create an application that allows the user to enter a property’s value and displays the sales tax on that property.arrow_forward
- When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period:d =1/2 gt2The variables in the formula are as follows: d is the distance in meters, g is 9.8, and t is the amount of time in seconds that the object has been falling. Create an application that allows the user to enter the amount of time that an object has fallen and then displays the distance that the object fell. The application should have a method named FallingDistance. The FallingDistance method should accept an object’s falling time (in seconds) as an argument. The method should return the distance in meters that the object has fallen during that time interval.arrow_forwardA painting company has determined that for every 115 square feet of wall space, 1 gallon of paint and 8 hours of labor will be required. The company charges $20.00 per hour for labor. Create an application that allows the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The 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_forwardYou’ll create both pseudocode and a flowchart to design an application that displays the following menu: Select a Planet 1. Mercury2. Venus3. Earth4. Mars5. Exit the programEnter your selection. When the user selects a planet from the menu, the program should display the following information about the planet: Mercury Average distance from the sun 57.9 million kilometers Mass 3.31 × 10^23kg Surface temperature –173 to 430 degrees Celsius Venus Average distance from the sun 108.2 million kilometers Mass 4.87 × 10^24kg Surface temperature 472 degrees Celsius Earth Average distance from the sun 149.6 million kilometers Mass 5.967 × 10^24kg Surface temperature –50 to 50 degrees Celsius Mars Average distance from the sun 227.9 million kilometers Mass 0.6424 × 10^24kg Surface temperature –140 to 20 degrees Celsiusarrow_forward
- Microsoft Visual Studio Softare. The user enters an integer into a text box and clicks on the Calculate button. The application will sum all of the integers from 1 to the number entered and display the sum in a label. The sum of numbers is the sum of all the numbers from 1 to the ending number. For example, if the user enters 3, the sum of numbers is 1 + 2 + 3 = 6. If the user enters 5, the sum of numbers is 1 + 2 + 3 + 4 + 5 = 15. Your program should work for any integer entered by the user. Use a loop to calculate the sum of numbers. You will need to initialize the variables and assign appropriate values. Get the value for intEndNum from the textbox. After the loop has run, display intSum in the label. Here is one way to code the loop: For intCount = 1 To intEndNum intSum = intSum + intCount Next Calculate Button Click-Event Procedure You may find following these steps helpful: Declare three variables intEndnum Ending number…arrow_forwardI am trying to create a application that generates a random number in the range of 1 through 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” If the user guesses the number, the application should congratulate the user and then generate a new random number so the game can start over. Accumulate the guesses until the user guesses the number. When the user correctly guesses the random number, the program should display the number of guesses they took. "You guessed the number in # guesses", where # is the number of guesses it took. And the programming language i am using is visual basic or vb.net 2019 editionarrow_forwardPython programming language You will be creating an application to calculate the maximum amount of contribution a person can make to a Roth IRA based on their age and income. Over 50 years old and your contribution limit goes up from $6000 to $7000 dollars. However, if the person is married and the combined household income is over $206,000 a year, or a single person with income over $139,000, you are not allowed to contribute. Write an application that asks the user their age and their income. Using this information use a nested if statement to calculate the maximum allowable contribution.arrow_forward
- A retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. The state sales tax rate is 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the following: The amount of county sales tax The amount of state sales tax The total sales tax (county plus state) Step 3: Complete the pseudocode by writing the missing lines. (Reference: Defining and Calling a Module, page 78-81). Also, when writing your modules and making calls, be sure to pass necessary variables as arguments and accept them as reference parameters if they need to be modified in the module. (Reference: Passing Arguments by Value and by Reference, page 97 – 103). Module main () //Declare local variables Declare Real totalSales…arrow_forwardCreate an application that calculates a car’s gas mileage. The formula for calculating the miles that a car can travel per gallon of gas is: MPG=milesgallonsIn the formula MPG is miles-per-gallon, miles is the number of miles that can be driven on a full tank of gas, and gallons is the number of gallons that the tank holds. The application’s form should have TextBox controls that let the user enter the number of gallons of gas the tank holds and the number of miles the car can be driven on a full tank. When the Calculate MPG button is clicked, the application should display the number of miles that the car can be driven per gallon of gas. The form should also have a Clear button that clears the input and results, and an Exit button that ends the application. If the user fails to enter numeric values, display an appropriate error message and do not attempt to perform calculations.arrow_forwardA retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. The state sales tax rate is 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the following: The amount of county sales tax The amount of state sales tax The total sales tax (county plus state) Step 2: Given the major task involved in this program, what modules might you consider including? Describe the purpose of each module. (Reference: Defining and Calling a Module, page 78). Module Name Purpose Module inputData () Allows the user to enter required user inputarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT