Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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 ArrayListprices=new ArrayList(); 17 for(int i=0; i Homework 4 (Java Application] /Users/chriscwilliams2/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_15.0.1.20201027-0507/jre/bin/jav Exception in thread "main" java.lang.Error: Unresolved compilation problems: prices cannot be resolved prices cannot be resolved prices cannot be resolved prices cannot be resolved to a variable prices cannot be resolved to a variable at MIS3339/homeworkchegg. homework4.main(homework4.java:34) 343 944 Writable Smart Insert 47:13: 1498 2 19.99 29.99 3 14.99 How many items are in this customer's transaction? Please enter the price of item #1: Please enter the price of item #2: The grand total of this transaction is: $49.98 Would you like to enter another customer's transaction data? (enter y or n) How many items are in this customer's transaction? Please enter the price of item #1: Please enter the price of item #2: 18.99 Please enter the price of item #3: 25.00 The grand total of this transaction is: $58.98 Would you like to enter another customer's transaction data? (enter y or n) y How many items are in this customer's transaction? Please enter the price of item #1: 2.99 Please enter the price of item #2: 2.99 Please enter the price of item #3: 3.99 Please enter the price of item #4 : 5.00 The grand total of this transaction is: $14.97 Would you like to enter another customer's transaction data? (enter y or n) The average value of today's transactions was: $41.31 The highest single transaction was: $58.98 The lowest single transaction was: $14.97 Table 1 - Example program input & output 4 n

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

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

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions