fork download
  1. package shoppingSystem;
  2.  
  3. public class Customer {
  4. // Name, Age, Gender (true = male)
  5. private String name;
  6. private int age;
  7. private boolean gender;
  8. private double walletMoney;
  9. private double money;
  10. private Money wallet;
  11. private Money creditcard;
  12.  
  13. public Customer(String n, int a, boolean g, double walletmoney, double creditcardmoney) {
  14. setName(n);
  15. setAge(a);
  16. setGender(g);
  17. wallet = new Money(walletmoney);
  18. creditcard = new Money(creditcardmoney);
  19. setCreditcard(new Money(creditcardmoney));
  20.  
  21. }
  22.  
  23. public String getName() {
  24. return name;
  25. }
  26.  
  27. public void setName(String name) {
  28. this.name = name;
  29. }
  30.  
  31. public int getAge() {
  32. return age;
  33. }
  34.  
  35. public void setAge(int age) {
  36. this.age = age;
  37. }
  38.  
  39. public String getGender() {
  40. if (gender) {
  41. return "male";
  42. } else {
  43. return "female";
  44. }
  45. }
  46. public void setGender(boolean gender) {
  47. this.gender=gender;
  48. }
  49.  
  50. public void setMoney(double money) {
  51. this.money = money;
  52. }
  53.  
  54. public void setMoneyWallet(double wallet) {
  55. this.walletMoney = wallet;
  56. }
  57.  
  58. public double getWalletMoney() {
  59. return walletMoney;
  60. }
  61.  
  62. public void setWalletMoney(double walletMoney) {
  63. this.walletMoney = walletMoney;
  64. }
  65.  
  66. public Money getCreditcard() {
  67. return creditcard;
  68. }
  69.  
  70. public void setCreditcard(Money creditcard) {
  71. this.creditcard = creditcard;
  72. }
  73.  
  74. public double getMoney() {
  75. return money;
  76. }
  77.  
  78. public double getMoneyWallet() {
  79. return wallet.getMoney();
  80. }
  81.  
  82. public String showMoney() {
  83.  
  84. return name + " are " +Math.round( wallet.getMoney() + creditcard.getMoney())+" $ in Total.";
  85. }
  86.  
  87. public String showWallet() {
  88.  
  89. return name + " has " + Math.round(wallet.getMoney() * 100.0) / 100.0 + " $ left in his wallet.";
  90. }
  91.  
  92. public void showInformations() {
  93. System.out.println(
  94. "Customername = " + getName() + " Customerage= " + getAge() + " Customergender= " + getGender());
  95. }
  96.  
  97. }
  98.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: error: class Customer is public, should be declared in a file named Customer.java
public class Customer {
       ^
Main.java:10: error: cannot find symbol
	private Money wallet;
	        ^
  symbol:   class Money
  location: class Customer
Main.java:11: error: cannot find symbol
	private Money creditcard;
	        ^
  symbol:   class Money
  location: class Customer
Main.java:66: error: cannot find symbol
	public Money getCreditcard() {
	       ^
  symbol:   class Money
  location: class Customer
Main.java:70: error: cannot find symbol
	public void setCreditcard(Money creditcard) {
	                          ^
  symbol:   class Money
  location: class Customer
Main.java:17: error: cannot find symbol
		wallet = new Money(walletmoney);
		             ^
  symbol:   class Money
  location: class Customer
Main.java:18: error: cannot find symbol
		creditcard = new Money(creditcardmoney);
		                 ^
  symbol:   class Money
  location: class Customer
Main.java:19: error: cannot find symbol
		setCreditcard(new Money(creditcardmoney));
		                  ^
  symbol:   class Money
  location: class Customer
8 errors
stdout
Standard output is empty