Guest User

Untitled

a guest
Jul 17th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Gadget
  3. {
  4. private int itemNumber;
  5. private String description;
  6. private double price;
  7. private Scanner input = new Scanner(System.in);
  8. //A single Gadget created by the company that contains
  9. //1.item number, integer
  10. //2.Description, string
  11. //3.a price, double positive
  12. //must be set by a constructor
  13. //all methods are read only
  14.  
  15. public Gadget()throws NumberFormatException{
  16.  
  17. System.out.println("What is the Item Number?");
  18. itemNumber = input.nextInt();
  19.  
  20. description = input.nextLine();
  21.  
  22. price = input.nextDouble();
  23. }
  24.  
  25.  
  26. public int getItemNumber()
  27. {
  28. return itemNumber;
  29. }
  30. public String getDescription()
  31. {
  32. return description;
  33. }
  34.  
  35. }
Add Comment
Please, Sign In to add comment