Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Input Validation Here's the premise: the Fast Freight Shipping Company charges the following rates: Write a program for the company that asks for

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Part 1: Input Validation Here's the premise: the Fast Freight Shipping Company charges the following rates: Write a program for the company that asks for the weight of the package and the distance it will be shipped, and display the total charge. Your program should validate the inputs it receives. If the program receives an invalid input value, it should tell the user that the value is wrong and what the range for the valid values is, and then ask them to rerun the program with valid inputs. (For an example of input validation, check out section 4.11 in the textbook). Your program should ensure that: - The weight of the package is not 0kg or less, or greater than 20kg. (It can be exactly 20, but not exactly 0. .) - The distance shipped is not less than 10 miles, or greater than 3,000 miles. (It can be exactly 10 or exactly 3,000.) Make sure your program shows a prompt whenever it asks for input or provides output. Your program should use appropriate types for the variables and show the total price using two decimal places of precision. The price calculation should use the following formula: (distance / 500 ) "rate Sample outputs: Part 2: Making Choices For this part you will be creating a program that asks for your dietary restrictions and then provides you with a list of local restaurants you are able to eat at. The restaurant choices and the options they provide are as follows: - Joe's Gourmet Burgers - Vegetarian: no, Vegan: no, Gluten-free: no - Main Street Pizza Company - Vegetarian: yes, Vegan: no, Gluten-free: yes - Corner Cafe - Vegetarian: yes, Vegan: yes, Gluten-free: yes - Mama's Fine Italian - Vegetarians yes, Vegan: no, Gluten-free: no - The Chef's Kitchen - Vegetarian: yes, Vegan: yes. Gluten-free: yes: Write a program that asks if you are vegetarian, vegan, or gluten-free, and then displays only the restaurants you can eat at. Here is an example of the program's output (user inputs are italicized): Are you vegetarlan? yes Are you vegan? no Are you gtuten-freel yes Here are yoor restaurant choices: Hain Street Pizza Conpany Corner Cafe The cher's Kitchen Here's the premise: the Fast Freight Shipping Company charges the following rates: Write a program for the company that asks for the weight of the package and the distance it will be shipped, and display the total charge. Your program should validate the inputs it redeives. If the program receives an invalid input value, it should teil the user that the value is wrong and what the range for the valid values is, and then ask them to rerun the program with valid inputs. (For an example of input validation, check out section 4.11 in the textbook). Your program should ensure that: - The weight of the package is not 0kg or less, or greater than 20kg. (It can be exactly 20, but not exactly 0,) - The distance shipped is not less than 10 miles, or greater than 3,000 miles. (It can be exactly 10 or exactly 3,000 .) Make sure your program shows a prompt whenever it asks for input or provides output. Your program should use appropriate types for the variables and show the total price using two decimal places of precision. The price calculation should use the following formula: (distance / 500) * rate Sample outputs: Part 1 sample Part 2: Making Choices Part 2: Making Choices For this part you will be creating a program that asks for your dietary restrictions and then provides you with a list of local restaurants you are able to eat at. The restaurant choices and the options they provide are as follows: - Joe's Gourmet Burgers - Vegetarian: no, Vegan: no, Gluten-free: no - Main Street Pizza Company - Vegetarian: yes, Vegan: no, Gluten-free: yes - Corner Cafe - Vegetarian: yes, Vegan: yes, Gluten-free: yes - Mama's Fine Italian - Vegetarian: yes, Vegan: no, Gluten-free: no - The Chef's Kitchen - Vegetarian: yes, Vegan: yes, Gluten-free: yes Write a program that asks if you are vegetarian, vegan, or gluten-free, and then displays only the restaurants you can eat at. Here is an example of the program's output (user inputs are italicized): Are you vecetarian? yes: Are you vezan? 00 Are you geuten-freel yes bere are your restadrant chalces: Kain-street Pizza Conpany Corner Cafe The Chef"s vitchen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions