Site icon Tutor Bin

West Valley College Java Project

West Valley College Java Project

Description

Programming Project #1: Manage Items

Objectives:

Use basic Java constructs: if, switch, repetition (looping) and functions

Perform simple data type and string object manipulations

Solve problem, design solution and implement using Java

Description:

  • Write a menu-driven program named “ManageItems” that provides the following options:
  • Add new item
  • Show most expensive item

Show all items

Exit

Basically, the program allows the user to add items, keep track of the most expensive item and the list of all items.

An item simply consists of its unit price (double) and description (string)

Requirements:

  1. The program must produce the same expected output as provided.
  2. The user must enter a valid PIN which is any 6-digt only number (no alphabet or special characters or blanks)
  3. You must define and use at least 5 methods in your program
  4. You are not allowed to use array or vector to keep track of items. Please use only string and string concatenation for the list of items and use local variables and pass-by-reference parameters to keep track of the most expensive item.

Required error handling:

The program MUST perform the following checks:

Check for bad pin code and allow up to 3 trials.

Check for negative price

Check for invalid menu answer

  1. Display “no entry” when there is no item entered yet.

Example of a run output:

  1. D:>java ManageItems
  2. Welcome to the item management program.
  3. Please enter the PIN code: 12345A
    Invalid pin code. Please try it again.
    Please enter the PIN code: A12345
    Invalid pin code. Please try it again.
    Please enter the PIN code: 123456

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 2

There is no item in the list.

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 3

There is no item in the list.

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 1

  1. Please enter item description: a box of pencils
    Please enter the item’s price: 9.999
    DESC(a box of pencils) UNIT-PRICE($10.00)
  2. Item Menu:
     1. add new item
     2. show most expensive item
     3. show all items
     4. exit
    Enter your option: 1
  3. Please enter item description: eraser case
    Please enter the item’s price: 1.2345
    DESC(eraser case) UNIT-PRICE($1.23)
  4. Item Menu:
     1. add new item
     2. show most expensive item
     3. show all items
     4. exit
    Enter your option: 1

Please enter item description: ruler
Please enter the item’s price: 3.14159
DESC(ruler) UNIT-PRICE($3.14)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 3

All items:
DESC(a box of pencils) UNIT-PRICE($10.00)
DESC(eraser case) UNIT-PRICE($1.23)
DESC(ruler) UNIT-PRICE($3.14)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 2

Most expensive item: DESC(a box of pencils) UNIT-PRICE($10.00)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 1

Please enter item description: a set of notebooks
Please enter the item’s price: 5.678
DESC(a set of notebooks) UNIT-PRICE($5.68)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 3

All items:
DESC(a box of pencils) UNIT-PRICE($10.00)
DESC(eraser case) UNIT-PRICE($1.23)
DESC(ruler) UNIT-PRICE($3.14)
DESC(a set of notebooks) UNIT-PRICE($5.68)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 2

Most expensive item: DESC(a box of pencils) UNIT-PRICE($10.00)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 1

Please enter item description: C++ textbook
Please enter the item’s price: 88.777
DESC(C++ textbook) UNIT-PRICE($88.78)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 3

All items:
DESC(a box of pencils) UNIT-PRICE($10.00)
DESC(eraser case) UNIT-PRICE($1.23)
DESC(ruler) UNIT-PRICE($3.14)
DESC(a set of notebooks) UNIT-PRICE($5.68)
DESC(C++ textbook) UNIT-PRICE($88.78)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 2

Most expensive item: DESC(C++ textbook) UNIT-PRICE($88.78)

Item Menu:
 1. add new item
 2. show most expensive item
 3. show all items
 4. exit
Enter your option: 4

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Exit mobile version