Question CS 250 Lab Exercise 06 Main topics: Boolean expressions If statements If-else statements While loops. Exercise This lab is designed to give you more practice using if-else statements, nested if statements, and an introduction to the while loop. Getting Started To start this exercise, you should 1. Open eclipse and start a new Java project named Lab06 2. Add CS 250 Lab Exercise 06 Main topics: Boolean expressions If statements If-else statements While loops. Exercise This lab is designed to give you more practice using if-else statements, nested if statements, and an introduction to the while loop. Getting Started To start this exercise, you should 1. Open eclipse and start a new Java project named Lab06 2. Add a Class (named Lab06) to this project. Problem Description For this lab you are to write as complete Java program to run a simple cash register for a cye glass store, A customer can buy either a pair of single prescription glasses (at a cost of \( \$ 40.00 \) ), or a pair of non-prescription sunglasses (at a cost of \( \$ 25.00 \) ). On each pair of single prescription glasses the customer must choose either an anti-glare coating (at a cost of \( \$ 12.50 \) ) or a brown tint coating (at a cost of \( \$ 9.99 \) ). Requirements At each point where the user is being presented with an option - You must display a simple menu with menu options and then repeatedly get the user's menu option until a "valid" option is entered. The valid menu option is then used to guide the program's logic from that point. Sample Run What kind of glasses would you like: \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 0 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 3 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 1 What kind of coating would you like: \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 0 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 3 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 1 Your total cost is \( \$ 52.5 \) Once you have written your program: 1. Make sure that your programs compile and rum without errors or warnings. 2. Run your program enough times to check all the choices for correctness. 3. If it runs correctly, then see your TA for a cherk-off.

YATQMH The Asker · Computer Science

Transcribed Image Text: CS 250 Lab Exercise 06 Main topics: Boolean expressions If statements If-else statements While loops. Exercise This lab is designed to give you more practice using if-else statements, nested if statements, and an introduction to the while loop. Getting Started To start this exercise, you should 1. Open eclipse and start a new Java project named Lab06 2. Add a Class (named Lab06) to this project. Problem Description For this lab you are to write as complete Java program to run a simple cash register for a cye glass store, A customer can buy either a pair of single prescription glasses (at a cost of \( \$ 40.00 \) ), or a pair of non-prescription sunglasses (at a cost of \( \$ 25.00 \) ). On each pair of single prescription glasses the customer must choose either an anti-glare coating (at a cost of \( \$ 12.50 \) ) or a brown tint coating (at a cost of \( \$ 9.99 \) ). Requirements At each point where the user is being presented with an option - You must display a simple menu with menu options and then repeatedly get the user's menu option until a "valid" option is entered. The valid menu option is then used to guide the program's logic from that point. Sample Run What kind of glasses would you like: \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 0 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 3 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 1 What kind of coating would you like: \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 0 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 3 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 1 Your total cost is \( \$ 52.5 \) Once you have written your program: 1. Make sure that your programs compile and rum without errors or warnings. 2. Run your program enough times to check all the choices for correctness. 3. If it runs correctly, then see your TA for a cherk-off.
More
Transcribed Image Text: CS 250 Lab Exercise 06 Main topics: Boolean expressions If statements If-else statements While loops. Exercise This lab is designed to give you more practice using if-else statements, nested if statements, and an introduction to the while loop. Getting Started To start this exercise, you should 1. Open eclipse and start a new Java project named Lab06 2. Add a Class (named Lab06) to this project. Problem Description For this lab you are to write as complete Java program to run a simple cash register for a cye glass store, A customer can buy either a pair of single prescription glasses (at a cost of \( \$ 40.00 \) ), or a pair of non-prescription sunglasses (at a cost of \( \$ 25.00 \) ). On each pair of single prescription glasses the customer must choose either an anti-glare coating (at a cost of \( \$ 12.50 \) ) or a brown tint coating (at a cost of \( \$ 9.99 \) ). Requirements At each point where the user is being presented with an option - You must display a simple menu with menu options and then repeatedly get the user's menu option until a "valid" option is entered. The valid menu option is then used to guide the program's logic from that point. Sample Run What kind of glasses would you like: \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 0 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 3 \( 1 \rightarrow \) prescription, \( 2 \rightarrow \) non-prescription : 1 What kind of coating would you like: \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 0 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 3 \( 1 \rightarrow \) anti-glare, \( 2 \rightarrow \) brown tint : 1 Your total cost is \( \$ 52.5 \) Once you have written your program: 1. Make sure that your programs compile and rum without errors or warnings. 2. Run your program enough times to check all the choices for correctness. 3. If it runs correctly, then see your TA for a cherk-off.
Community Answer
FRI2HB

【General guidance】The answer provided below has been developed in a clear step by step manner.Step1/3Problem Overview:The program is a simple application of conditional statements (if-else) and looping statement( while loop) .First user input for type of glasses is taken.There are 2 valid options for this input - 1 or 2. So ask input till user enters a valid value for input( either 1 or 2).Similarly input is taken of coating for the chosen glasses above.This filed also has only 2 valid options. So ask input till user enters either one of these.Explanation:Please refer to solution in this step.Step2/3Calculation of final price:If user enters 1(prescription) for type of glasses, it would cost \( \mathrm{\${40.0}} \).But if user enters 2 then it would cost \( \mathrm{\${25.00}} \)The user can only enter either one of these two options.-Now for these glasses, type of coating is taken as input. If user enters 1(anti-glare) that is \( \mathrm{\${12.50}} \)But if 2(brown tint) is entered then it's price is \( \mathrm{\${9.99}} \).-According to input values any 1 from above and one from below prices would be added up and total cost is calculated and printed.-Programming language used: Java.Explanation:Please refer to solution in this step.Step3/3JAVA CODE:import java.util.Scanner;public class Main{ // function to show type glasses static void showGlasses(){ System.out.print("1 -> prescription, 2 ->non-prescription: "); } // function to show type of coatings for glasses static void showCoating(){ System.out.print("1 -> anti-glare, 2 ->brown tint: "); } // function to calcuate and print final cost of glasses static void calculatePrice(i ... See the full answer