Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use eclipse editor to complete this exercise Use the following UML as the solution for the supportive class design: Order - ITEM_NAMES : String[] =

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

Use eclipse editor to complete this exercise

Use the following UML as the solution for the supportive class design: Order - ITEM_NAMES : String[] = {"Premium Sod, Special Sod, Basic Sod"} - ITEM PRICES : double[] = {9.95, 5.95, 1.95) - DISCOUNT_NAMES : String[] = {*Member, Senior", "No Discount"} - DISCOUNT_RATES: double[] = {0.25, 0.15, 0.0} - TAX_RATE : double = .075 - itemCounts : int[] //set to size of ITEM_NAMES.length - discount Counts: int[] //set to size of DISCOUNT_NAMES.length - itemSelection : char - discountType : char - itemName : String - itemPrice : double - discountName : String - discountRate : double - howMany: int + Order():NA + setItemSelection(borrowedMenuSelection : char): void//uses ONLY 1 assignment statement to assign borrowedMenuSelection to itemSelection + setItemName(): void //uses ONLY 1 selection structure to test itemSelection) to assign the ITEM_NAMES element (1.e. ITEM_NAMES/OT) to itemName and increment the itemCounts element (1.e. itemCounts[0]) + setItemPrice(): void /uses ONLY 1 selection structure to test itemSelection) to assign the ITEM_PRICES element (1.e. ITEM PRICES(O) to itemPrice + setHow Many(borrowedHowMany: int) : void //assigns borrowedHow Many to howMany + setDiscountType(borrowedMenuSelection : char): void /uses ONLY 1 assignment statement to assign borrowedMenuSelection to discount Type + set DiscountName(): void /uses ONLY 1 selection structure (to test discountType) to assign the DISCOUNT_NAMES element (1.e. DISCOUNT_NAMES[0]) to discountName and increment the discount Counts element (i.. discount Counts[0]) + set DiscountRate(): void //uses ONLY 1 selection structure (to test discountType) to assign the DISCOUNT_RATES element (1.e. DISCOUNT_RATES(O) to discountRate + getItemName(): String + getItemPrice(): double + getHowMany: int + getDiscountName(): String + getDiscountRate(): double + getDiscountAmt(): double //uses a calculation in the return statement + getDiscountPrice(): double //uses a calculation in the return statement + getSubTotal() : double //uses a calculation in the return statement + getTax Rate(): double + getTaxAmt(): double //uses a calculation in the return statement + getTotalCost(): double //uses a calculation in the return statement + getItemNames(): String[ Page 2 of 9 + getItemPrices(): double[] + get DiscountNames(): String) + getDiscountRates(): double[] + getItemCounts(): int[] + getDiscountCounts(): int[] HINTS: Hints may be provided as green comments, but they would not be found on actual UMLs. NOTE: The supportive class submit MUST match the UML attributes and behaviors exactly as listed. Use the following Class Constants and Flowcharts as the solution for the MainClass design. MAINCLASS CONSTANTS (WITH CLASS SCOPE): Name Type Description MENU CHARS final char Fixed names of 'A', 'Q' MENU OPTIONS final String Fixed names of "Create Order". "Quit" SUB_MENU_CHARS final char Fixed names of 'A', 'B', 'C' NOTE: These are the ONLY constants permitted in MainClass. THE MENU FIRST, each menu must have a title. SECOND, each menu option must be listed on a separate line. THIRD, each menu option must have a clear character choice. FOURTH, each menu options must be formatted in columnar-style organization. FIFTH, each option must use constants (i.e. names/prices) and an appropriate format (i.e. currency). SIXTH, only Q to Quit can end a program from the MAIN MENU. LASTLY, there must be a prompt for user input after the last menu option. NOTE: All of these option and content formatting elements are REQUIRED on EVERY Menu. OPTION DETAILS: Menus must include full option details, such as names, prices, rates, units, etc. The following is the REQUIRED main menu for the program: MAIN MENU A for Create Order Q for Quit Enter your selection here: The following is the REQUIRED item menu for the program: ITEM MENU A for Premium Sod B for Special Sod C for Basic Sod $ 9,95 $5.95 $ 1.95 Please make your selection here: REMINDER: Currency values must be displayed with a dollar sign and 2 decimal places. The following is the REQUIRED discount menu for the program: DISCOUNT MENU A for Member B for Senior C for No discount 25.0 % 15.0 % 0.0 % Page 7 of 9 Please make your selection here: FORMATTING RULES: WIDTH: Columns must use a minimum width to fit the largest value expected, plus 1 for padding. LENGTH: Line length for output on the console cannot exceed 60 characters. CURRENCY: Currency values must be formatted with a dollar sign ($) and 2 decimal places. DOUBLE: Doubles (non-currency) must be formatted with only 1 decimal place. PERCENTAGES: Percentages/rates must be formatted with 1 decimal place and a percentage sign (%). RATES: To display a value as a rate, multiply the value by 100 in the output line (i.e. value* 100). ALIGNMENT: Column values and decimals (on menu and reports) must align on all rows. FORMAT: All menus and reports must be simple, direct, and use columnar-style organization. For testing, enter the following: For the user's name, enter: Bob For the main selection, enter: R Then, enter: R Then, enter: A For the item selection, enter: R Then, enter: R Then, enter: A For the quantity, enter: 0 Then, enter: -5 Then, enter: 5 For the discount selection, enter: R Then, enter: R Then, enter: A The following is the format REQUIRED for the program's order report: NIU NINN NN NN NN NNNNNNNNNNNNNNNNNNNNNN ORDER REPORT III NUNN NNNN NIIN NIIN NIIN NNNN NN NN NN NN NNNN Item Name: [name] Item Price: $ value Discount Name: Discount Rate: Discount Amount: Discount Price: [name] value % $ value $ value value Quantity: Subtotal: Tax Rate: Tax Amount: $ value value % value $ Page 8 of 9 Order Total: $ value ANNNNNNNNNNN wwwman www For continued testing, enter different values, using valid/invalid values at each menu/prompt. To complete testing and exit the run-while: For the main selection, enter: Q The following is the format REQUIRED for the program's final report: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN FINAL REPORT NIU NINN NN NN NN NNNNNNNNNNNNNNNNNNNNNN Employee Name: Bob Item counts: [borrowed name] [borrowed name] [borrowed name] [##] [##] [##] Discount counts: [borrowed name] [borrowed name] [borrowed name] [##] [##] FORMAT REQUIREMENT: ALL menus and reports must be complete, accurate, and displayed using System.out.printf(with ONLY format specifiers inside the quotation marks), with columnar-style organization and appropriate formats used for integers, doubles, and currency. Use the following UML as the solution for the supportive class design: Order - ITEM_NAMES : String[] = {"Premium Sod, Special Sod, Basic Sod"} - ITEM PRICES : double[] = {9.95, 5.95, 1.95) - DISCOUNT_NAMES : String[] = {*Member, Senior", "No Discount"} - DISCOUNT_RATES: double[] = {0.25, 0.15, 0.0} - TAX_RATE : double = .075 - itemCounts : int[] //set to size of ITEM_NAMES.length - discount Counts: int[] //set to size of DISCOUNT_NAMES.length - itemSelection : char - discountType : char - itemName : String - itemPrice : double - discountName : String - discountRate : double - howMany: int + Order():NA + setItemSelection(borrowedMenuSelection : char): void//uses ONLY 1 assignment statement to assign borrowedMenuSelection to itemSelection + setItemName(): void //uses ONLY 1 selection structure to test itemSelection) to assign the ITEM_NAMES element (1.e. ITEM_NAMES/OT) to itemName and increment the itemCounts element (1.e. itemCounts[0]) + setItemPrice(): void /uses ONLY 1 selection structure to test itemSelection) to assign the ITEM_PRICES element (1.e. ITEM PRICES(O) to itemPrice + setHow Many(borrowedHowMany: int) : void //assigns borrowedHow Many to howMany + setDiscountType(borrowedMenuSelection : char): void /uses ONLY 1 assignment statement to assign borrowedMenuSelection to discount Type + set DiscountName(): void /uses ONLY 1 selection structure (to test discountType) to assign the DISCOUNT_NAMES element (1.e. DISCOUNT_NAMES[0]) to discountName and increment the discount Counts element (i.. discount Counts[0]) + set DiscountRate(): void //uses ONLY 1 selection structure (to test discountType) to assign the DISCOUNT_RATES element (1.e. DISCOUNT_RATES(O) to discountRate + getItemName(): String + getItemPrice(): double + getHowMany: int + getDiscountName(): String + getDiscountRate(): double + getDiscountAmt(): double //uses a calculation in the return statement + getDiscountPrice(): double //uses a calculation in the return statement + getSubTotal() : double //uses a calculation in the return statement + getTax Rate(): double + getTaxAmt(): double //uses a calculation in the return statement + getTotalCost(): double //uses a calculation in the return statement + getItemNames(): String[ Page 2 of 9 + getItemPrices(): double[] + get DiscountNames(): String) + getDiscountRates(): double[] + getItemCounts(): int[] + getDiscountCounts(): int[] HINTS: Hints may be provided as green comments, but they would not be found on actual UMLs. NOTE: The supportive class submit MUST match the UML attributes and behaviors exactly as listed. Use the following Class Constants and Flowcharts as the solution for the MainClass design. MAINCLASS CONSTANTS (WITH CLASS SCOPE): Name Type Description MENU CHARS final char Fixed names of 'A', 'Q' MENU OPTIONS final String Fixed names of "Create Order". "Quit" SUB_MENU_CHARS final char Fixed names of 'A', 'B', 'C' NOTE: These are the ONLY constants permitted in MainClass. THE MENU FIRST, each menu must have a title. SECOND, each menu option must be listed on a separate line. THIRD, each menu option must have a clear character choice. FOURTH, each menu options must be formatted in columnar-style organization. FIFTH, each option must use constants (i.e. names/prices) and an appropriate format (i.e. currency). SIXTH, only Q to Quit can end a program from the MAIN MENU. LASTLY, there must be a prompt for user input after the last menu option. NOTE: All of these option and content formatting elements are REQUIRED on EVERY Menu. OPTION DETAILS: Menus must include full option details, such as names, prices, rates, units, etc. The following is the REQUIRED main menu for the program: MAIN MENU A for Create Order Q for Quit Enter your selection here: The following is the REQUIRED item menu for the program: ITEM MENU A for Premium Sod B for Special Sod C for Basic Sod $ 9,95 $5.95 $ 1.95 Please make your selection here: REMINDER: Currency values must be displayed with a dollar sign and 2 decimal places. The following is the REQUIRED discount menu for the program: DISCOUNT MENU A for Member B for Senior C for No discount 25.0 % 15.0 % 0.0 % Page 7 of 9 Please make your selection here: FORMATTING RULES: WIDTH: Columns must use a minimum width to fit the largest value expected, plus 1 for padding. LENGTH: Line length for output on the console cannot exceed 60 characters. CURRENCY: Currency values must be formatted with a dollar sign ($) and 2 decimal places. DOUBLE: Doubles (non-currency) must be formatted with only 1 decimal place. PERCENTAGES: Percentages/rates must be formatted with 1 decimal place and a percentage sign (%). RATES: To display a value as a rate, multiply the value by 100 in the output line (i.e. value* 100). ALIGNMENT: Column values and decimals (on menu and reports) must align on all rows. FORMAT: All menus and reports must be simple, direct, and use columnar-style organization. For testing, enter the following: For the user's name, enter: Bob For the main selection, enter: R Then, enter: R Then, enter: A For the item selection, enter: R Then, enter: R Then, enter: A For the quantity, enter: 0 Then, enter: -5 Then, enter: 5 For the discount selection, enter: R Then, enter: R Then, enter: A The following is the format REQUIRED for the program's order report: NIU NINN NN NN NN NNNNNNNNNNNNNNNNNNNNNN ORDER REPORT III NUNN NNNN NIIN NIIN NIIN NNNN NN NN NN NN NNNN Item Name: [name] Item Price: $ value Discount Name: Discount Rate: Discount Amount: Discount Price: [name] value % $ value $ value value Quantity: Subtotal: Tax Rate: Tax Amount: $ value value % value $ Page 8 of 9 Order Total: $ value ANNNNNNNNNNN wwwman www For continued testing, enter different values, using valid/invalid values at each menu/prompt. To complete testing and exit the run-while: For the main selection, enter: Q The following is the format REQUIRED for the program's final report: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN FINAL REPORT NIU NINN NN NN NN NNNNNNNNNNNNNNNNNNNNNN Employee Name: Bob Item counts: [borrowed name] [borrowed name] [borrowed name] [##] [##] [##] Discount counts: [borrowed name] [borrowed name] [borrowed name] [##] [##] FORMAT REQUIREMENT: ALL menus and reports must be complete, accurate, and displayed using System.out.printf(with ONLY format specifiers inside the quotation marks), with columnar-style organization and appropriate formats used for integers, doubles, and currency

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

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago