Description of this paper

Java IP 3 assignment Question




Your consulting firm has been hired to develop a program that meets the following requirements.;Your program must provide a menu to the user. This menu should list five different products of your choice. Once the user selects one product, they should specify which state they are located. The state choices should include CT, VT, WI, CA and WA. State taxes vary for each state (7.5%, 7.8%, 6.8%, 7.2% and 6.4%, respectively). The user should then specify the desired number of cases (assume there are 12 items per case). The appropriate state tax should be added to the total cost of the product (Item quantity multiplied by unit price). Next, using the Math class random method, generate 20 numbers ranging between 1-100. Ensure there are no duplicates.;Display the following to the user.;Name of the product selected;Number of cases;Number of items;Subtotal (units * price per unit);State tax (with the percentage and state abbreviation in parentheses);Total cost (subtotal plus state tax);The table of random numbers displayed in a table of five numbers per row;Requirements;You need to use at least one repetition statement, one selection statement, Scanner class, at least one array and the random method in this code. For generating random numbers you should use the random () static method of class Math. It returns a double so you will need to cast it as an integer. For example;number = (int) (range * Math.random ()) + 1;Your assignment submittal should include your Java program with commented Java source code files.;Unit3 - Discussion Board;Unit 3 Discussion Board;ITCO620-1401D-01;Object-Oriented Applications;American Intercontinental University;An array in programming is an object that contains a number of values that are the same type. An array also only holds a fixed number of values inside, so when an array is created the length is defined initially. ?An item inside the array is known as an element and each element is accessed by its numerical index? (Oracle, 2014). With that being said, an array also always starts at 0 and works it way up until the maximum fixed number. Control structures are exactly what they sound like, they break up the flow of execution statements from top to bottom. This is usually done by using a decision-making statement, such as the if, switch, break or return statements.;Flow control measures such as the ?if? statement, which is a logical control measure, is used to meet a certain requirement. For example, if the program was looking to see if a person is of the legal drinking age, it could use the code ?if (person >= 21)? and then print out whatever statement that a programmer would like it to read when the person is greater than or equal to 21 or less than 21 respectively. The switch statement is similar in a way to the ?if? statement but adds an extra feature. This basic feature allows for multiple execution paths using the ?case? keyword. If there are going to be multiple possible paths a statement can take, the switch statement is a good choice. Another choice the programmer could take is to set up a loop. There are three different types of loops including: for loop, while loop, and do while loops. A for loop is useful when the programmer knows how many times a task needs to be repeated. ?A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times? (Tutorialspoint, 2014). The while loop is used mostly in conjunction with Boolean statements. This loop will continue to run as long as the condition is true, but when the condition is false the loop stops. Finally, the do while loop is very similar to the while loop except it evaluates from the bottom of the statements instead of the top down approach that the while loop takes.;A good real life example that I?ve encountered on many occasions is being able to calculate my average grade in school. When I was attending Purdue university for my undergrad, we didn?t have the luxury of an average grade calculator as they do here at AIU. I ended up manually adding them into a spreadsheet and adding them all up, then dividing by the number of grades. This had to be done per class, which was kind of a nuisance. Here is a program that could be used to calculate the average grade with the use of selection constructs;importjava.util.Scanner;classAverageGrade;public static void main(String[] args);int a, b, c, d, results;Scanner input = new Scanner(;System.out.println("Input your four grades to find out the average ");a = input.nextInt();b = input.nextInt();c = input.nextInt();d = input.nextInt();results = (a + b + c + d) / 4;System.out.println("Average Grade = " + results);Please give your opinion to this discussion please?


Paper#69306 | Written in 18-Jul-2015

Price : $37