logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

In this task, you will write a complete program in Python that computes the cost of breakfast at the MIT Brekky! Restaurant.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Assignment Tasks                                                                                                                                                                 

This assignment focuses on programming basics, expressions, variables, constants, methods, selection and loops. It is divided into two parts: Part A (Due in Week 3) and Part B (Due in Week 7). A report has to be submitted for both parts separately on respective Moodle links.

PART A:  Expressions and Operations: (8+ 2 Marks)

  1. Print the following statement 3 times such that they look like this:

“Now is better than never.”

“Now is better than never.”

“Now is better than never.”

  1. When you’re writing long numbers, you can group digits using underscores to make large numbers more readable:

>>> universe_age = 14_000_000_000

  1. Print the above variable on the python shell prompt.
  2. Add 12 billion to it and print the result.

 

  1. What is the output of the following multiple assignment statement?
    1. Print the values and the types of each variable.

>>> x, y, z = 0, -15, 5.75

  1. Cast variable z to an integer type and print the result
  2. Cast variable x to string type and explain your answer
  1. What is the output of the following expression? Justify your answer in the demo.
    1. 9/3*4+6%2*2/2*3.
    2. 13//4/2
    3. Take a value from the user, e.g. a=5. What is the output of a >-2. Test all cases.

PART B:  Functions : (18+2 Marks)

In this task, you will write a complete program in Python that computes the cost of breakfast at the MIT Brekky! Restaurant.

Your program is expected to prompt the user for input and validate it before computing the results. Your program will make use of expressions, decisions, and input/output in Python.

Functional Requirements:

The program will prompt the user for various pieces of information about the desired breakfast. Some of the information is dependent on the type of breakfast being ordered. Once all the information has been entered, the program will compute and display the amount of money (including tax) charged for the customer’s breakfast.

  • The customer can build a custom breakfast from the following individual food and beverage items: egg ($0.99 each), mix fruit salad ($2.5 per box), sausage ($3.5 each), hash brown ($1.19 each), toast ($0.79 per slice), coffee ($1.09 per cup), and tea ($0.89 per tea bag). For example, the customer can order two eggs with two toasts and a cup of coffee.
  • Alternatively, the customer can order a small, regular , or big breakfast:
  • The program will display the available choices in the following way:

For instance, if the customer wants a big breakfast, the user will type:

big breakfast .

 The program will then ask for the quantity (how many big breakfasts).

The program continues to ask for additional menu items by re-displaying the choices.

When the customer is done ordering, the user enters 111, the program then displays the pre-tax total, the tax, and the total with tax.

 

  • The program will compute the total cost of the order with additional taxes of 13%. All the costs are to be rounded to the nearest penny, and displayed with a dollar sign and two decimal positions. For example, a total cost of 13.66666 will be displayed as $13.67output.
  • The program must also detect and report invalid input; that is, the input must match one of the keywords or phrases exactly (ignoring upper case and spaces). When an invalid input is detected, the program will display an error message, and prompt for the input until the user enters it correctly

Functional specifications:

  1. Your assignment should include the following in the .ZIP archive:
  • A Word report with sections containing:
    1. An overview of the problem description of the assignment
    2. Pseudocode as an algorithm for the program
  • A flow chart which shows how your program functions from start to the end
  1. Screen shot/capture of the program output
  2. Acknowledgment of any help taken for assignment completion
  • Python files that can be executed by your tutor
  1. Instructions for archiving and submitting your files:
  • Create a folder and name it with your student ID (MITxxxxxx, where xxxxxx are digits of your student number)
  1. Copy your Word document and the python files into that folder.
  2. Zip the folder.
    1. Right-click on the folder
    2. In the pop-up menu select Send-to, Compressed (zipped)Folder
  • Upload the zip folder under Assignment 1 folder at Moodle.

Non-Functional Requirements:

  • Include brief comments in your code identifying yourself, describing the program, and describing key portions of the code. 
  • Assignments are to be done individually and must be your own work. Software may be used to detect academic dishonesty (cheating). 
  • Use Python coding conventions and good programming techniques. For example: 
  • Meaningful variable names
  • Conventions for naming variables and constants
  • Use of constants where appropriate
  • Readability, indentation, and consistency
  • Do not include/dump in screenshot of codes in written document. This document must contain algorithm and relevant screenshot of output. Code dumped in document will attract zero marks.
(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

806 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

615 Answers

Hire Me
expert
AyooluwaEducation

860 Answers

Hire Me
expert
RIZWANAMathematics

638 Answers

Hire Me

Get Free Quote!

414 Experts Online