Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Gadget
- {
- private int itemNumber;
- private String description;
- private double price;
- private Scanner input = new Scanner(System.in);
- //A single Gadget created by the company that contains
- //1.item number, integer
- //2.Description, string
- //3.a price, double positive
- //must be set by a constructor
- //all methods are read only
- public Gadget()throws NumberFormatException{
- System.out.println("What is the Item Number?");
- itemNumber = input.nextInt();
- description = input.nextLine();
- price = input.nextDouble();
- }
- public int getItemNumber()
- {
- return itemNumber;
- }
- public String getDescription()
- {
- return description;
- }
- }
Add Comment
Please, Sign In to add comment