Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package ee.tthk.tarpe17;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ProductTester {
  6.  
  7. public static void main(String[] args) {
  8.  
  9. Scanner in=new Scanner(System.in);
  10. int tempNumber;
  11. String tempName;
  12. int tempQty;
  13. double tempPrice;
  14. System.out.println("Enter an id:");
  15. tempNumber=in.nextInt();
  16. System.out.println("Enter a name:");
  17. tempName=in.next();
  18. System.out.println("Enter quantity:");
  19. tempQty=in.nextInt();
  20. System.out.println("Enter a price:");
  21. tempPrice=in.nextDouble();
  22. Product p1=new Product(tempNumber,tempName,tempQty,tempPrice);
  23. int tempNumber2;
  24. String tempName2;
  25. int tempQty2;
  26. double tempPrice2;
  27. System.out.println("Enter an id:");
  28. tempNumber2=in.nextInt();
  29. System.out.println("Enter a name:");
  30. tempName2=in.next();
  31. System.out.println("Enter quantity:");
  32. tempQty2=in.nextInt();
  33. System.out.println("Enter a price:");
  34. tempPrice2=in.nextDouble();
  35. Product p2=new Product(tempNumber2,tempName2,tempQty2,tempPrice2);
  36. /*Product salt=new Product();
  37. Product cheese=new Product();
  38. Product lettuce=new Product(1,"Maxima lehtkapsas",2000,0.80);
  39. Product tomato=new Product(2,"Maxima tomatid",1000,1.2);
  40. Product flour=new Product(3,"Veski mati jahu",3000,1.6);
  41. Product vodka=new Product(4,"Laua viin",2500,6.99);
  42. System.out.println(salt);
  43. System.out.println(cheese);
  44. System.out.println(lettuce);
  45. System.out.println(tomato);
  46. System.out.println(flour);
  47. System.out.println(vodka);
  48. */
  49.  
  50.  
  51.  
  52.  
  53. }
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement