java program for Requirements Input Create a shopping list o

java program for

Requirements:

Input: Create a shopping list of 7 items (in an array).

·        Take input from the user that puts the shopping item name and priority into an array, multiple arrays ok.

·        Set the price for all the items in the shopping list down to the penny. (Make sure the total of the items > $100.00)

·        Sort the items in the list by order of priority

1.     Present the items back to the user and have the user determine the order of importance for the item to purchase.

·        Only have one entry of any type in the list, list entry name (ex. Apple). If the user tries to add the same item twice tell the user that it is already on the list.

·        Set the price, cost, of each item down to the penny.

·        Now go shopping , purchase as many items on the list by priority, using $59.00

1.     Purchase the highest priority items first then go to the lower priority items and purchase them as needed, minimizing the amount of money left over.

·        Display the list of what was purchased, its price, and what wasn’t purchased, and its price (what could be used for the next shopping list).

Program must have:

·        Create an equals method for every physical class.

·        Make class attribute private

·        Have get and set methods to access items in the shopping list

·        Have defined class constructors

·        Include multiple classes(you determine what classes to create, what make sense)

·        Include pseudo code, UML diagram, test plans, and .java file

Other directions:

·        You are not allowed to use ArrayLists or Vectors, Buffers of any type, or I/O Streams of any type, only primitive arrays or string arrays will be allowed.

Solution

import java.util.Arrays; 02 import java.util.Scanner; 03 04     public class HW3 extends ShoppingItem 05     { 06         private static final String String = null; 07 08         private ShoppingItem[] shoppingList; 09           10       11     public void getData() 12     { 13         Scanner keyboard = new Scanner(System.in); 14         System.out.println(\"You can add seven items to purchase when 15                                     prompted \"); 16         shoppingList = new ShoppingItem[7]; 17           18         for (int i = 1; i<= 7; i++) 19         { 20             shoppingList[i] = new ShoppingItem(); 21             System.out.println(\"Enter data for the shopping item \" + i); 22             shoppingList[i].readInput(); 23             System.out.println(); 24         } 25     }
java program for Requirements: Input: Create a shopping list of 7 items (in an array). · Take input from the user that puts the shopping item name and priority

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site