Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 2: Input, Output, Variables and Arithmetic Operators Assigned: February 12. 2021 Due: February 19, 2021. 11:30 AM (before class) Objective: To help you get

image text in transcribed
image text in transcribed
Lab 2: Input, Output, Variables and Arithmetic Operators Assigned: February 12. 2021 Due: February 19, 2021. 11:30 AM (before class) Objective: To help you get familiar with using variables Overview: Titan Bakery sells 4 to go items (at outrageous prices, incidentally). Category Price $ Bagels 8 Biscuits 2 Muffins 6 Rolls 4 Your program will ask the customer how many bagels, biscuits, muffins and rolls they want and then print out the total number of items, and the total bil. For example, if there were 10 bagels, 4 biscuits, 12 muffins, and 8 rolls, then it would print out that the total number of items is 34, and the bill is 192. Instructions: 1. Create a new BlueJ project, Lab2, with a class called Bakery 2. Replace the contents of Bakery with a main method 3. Before writing any code, write an algorithm in pseudocode, describing the steps required to solve this problem -- think of the necessary input, processing, and output. For example, 1. ask the customer for the number of bagels 2. store the number of bagels in a variable, numBagels, etc. Write the pseudocode in the comment block at the top of the file 4. Paste the pseudocode into the main() method of Bakery, as single line comments, e.g.. // ask the customer for the number of bagels // store the number of bagels in a variable, numBagels 5. Now implement your program: beneath each comment, write a Java statement to accomplish the task, e.g., // ask the customer for the number of bagels System.out.print("# of bagels: "); 17 store the number of bagels in a variable, numBagels numBagels - 7 6. Your variables should all be ints. Sample Output (use these values for your screenshot): Welcome to Titan Bakery # of bagels: 10 # of biscuits: 4 # of muffins: 12 # of rolls: 8 # of items: 34 Bill: $192 Numbers in bold are entered by the bakery employee at runtime Deliverables: To complete this lab: 1. Run through the checklist below 2. Demo the lab to either the Lab Assistant or the instructor. Submit your entire Lab (zip the entire project) and upload it to Canvas 3. Submit a screenshot showing the output, in the terminal window. Upload it separately -- not zipped in the lab - so I can see it in Canvas' SpeedGrader. Checklist (not to hand in): Auto-layout applied? (command-shift-1 or ctr-shift-I) Comment block filled in? (Name, Date, Description) Descriptive identifier names chosen? (a, c, se, and st will get a 0 for sure) Redundant parentheses removed? --e.ga = (bc) + (de); or worse a = (bc) + (de)); Both should be written a = b c + d'e; Speling/spacing checked? Your output should match mine. Appropriate blank lines in the code to aid legibility? (e.g. 1 blank line separating input Defined variables for any calculation? (Don't just print the formula in the System.out.printin statement) Uploaded project? (even if you've demoed, you still need to upload project) Uploaded separate screenshot of output? Read this checklist

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

=+d. Emotional Approach appeal to consumers' emotions.

Answered: 1 week ago

Question

What are the best practices for managing a large software project?

Answered: 1 week ago

Question

How does clustering in unsupervised learning help in data analysis?

Answered: 1 week ago

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago