Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I used a do-while loop and when I use that loop it makes my variables not resolved. My teacher said it has to do with
I used a do-while loop and when I use that loop it makes my variables not resolved. My teacher said it has to do with the variable scope and I am confused on how to fix it.
Objective: For this assignment, you will demonstrate that you can properly manipulate the Eclipse IDE and create, compile, and execute a basic Java program using appropriate fundamental programming techniques. This will include following data input, proper logic control structures, data type requirements, naming, formatting and style conventions Computer programming is a precise task, this assignment will also verify that you can meet precise requirements by generating exactly expected output given various inputs. Description: Proper programming requires a very strict adherence to conventions along with an understanding and capability to use a variety of techniques and concepts. You will write a program using appropriate logic control structures in conjunction with declaring a series of variables of appropriate data types and performing a series of basic output tasks using a variety of predefined inputs while adhering to all expected conventions of a Java program presented in the text, classroom, and demonstration code. The results of your program should generate output as exemplified below in Table 1 given the predefined input also provided below in Table 1. Assignment: Create a command-line Java program in a class named "Homework4" that performs the following o Given the activity diagram provided in Figure 1 below, create the necessary Java code to satisfy the algorithmic requirements Note: Your program should perform the correct number of data entry repetitions based upon the 1s" value provided by the user. It should correctly output all entered values on the last line. It should additionally calculate the transaction total to 2 decimal places as a double value given the item prices provided by the user regardless of the actual values entered during runtime. Table 1 below shows the example input/output used by MISGrader's test case, there are other hidden test cases that you do not have knowledge of the values provided. Helpful tip: Data output formatting should always be specified even when we think it should work as expected. There are various reasons that may impact the number of significant digits retained or created during mathematical operations. We should always explicitly specify the output formatting for any numeric calculation. Note: The data input where the end user enters 'y' or 'n' to enter another customer's transaction data should work correctly whether the user enters upper case or lower case. Helpful tip: the .equalsignoreCase() method will allow checking two string values while ignoring the case of the values. Submit your Java code to the appropriate MISGrader assignment using your personalized link provided via email at the start of the course. act Activity diagram (n] Input "How many items are in this customer's transaction?" Input "Please enter the price of item # index Store price in data structure Output "The lowest single transaction was: $ calculated Repeat n times Output "The grand total of this transaction is: $" calculated Store transaction total in data structure W Input "Would you like to enter another customer's transaction data? (enter y orn)" Output "The average value of today's transactions was: $ calculated Output "The highest single transaction was: $" calculated [n] Figure 1 - Activity diagram 1. 12 4x E *homework 4.java X do{//begin do while 13 System.out.println("How many items are in this custome's transaction?"); 14 String numofitems=userInput.nextLine(); 15 16 ArrayListStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started