0

Anyone can please help me with my code I'm facing some error and i can't fix it (java)

I'm trying to do a simple problem solving but got some error in it ,if anyone wish to help please drop your e-mail down i will send you my code ,thanks

25th Mar 2020, 2:53 AM
Jack
6 ответов
+ 1
Can you post the code here?
25th Mar 2020, 3:04 AM
Gabe
Gabe - avatar
0
package assmember1; import java.util.Scanner; /** * * @author ASUS */ public class AssMember1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner keyboard = new Scanner(System.in); System.out.println("WELCOME TO BODY-FIT CENTER MEMBERSHIP SYSTEM"); System.out.println("Please Enter Number Of Member"); int x = keyboard.nextInt(); MemberList m1 = new MemberList(x); for (int i = 0; i < x; i++) { System.out.println("Please Enter Your Name"); String nm = keyboard.next(); System.out.println("Please Enter Your Member ID"); int id = keyboard.nextInt(); System.out.println("Please Enter Your Address"); String add = keyboard.next(); System.out.println("Please Enter Your Phone Number"); int hp = keyboard.nextInt(); m1.addMember(nm,
25th Mar 2020, 3:21 AM
Jack
0
id, add, hp, hp); } System.out.println("Please Enter Your Member Type" + "\n1= Walk-in" + "\n2= Normal" + "\n3= VIP"); int i = keyboard.nextInt(); if (i == 1) { System.out.println("How Many Days Would Like To Join?"); int days = keyboard.nextInt(); m1.setDays(days); m1.calculateFee(); System.out.println("Your Total Fee is = RM" + m1.getFee()); } else { m1.calculateFee(); System.out.println("Your Total Fee is = RM" + m1.getFee()); } System.out.print(m1.toString()); } }
25th Mar 2020, 3:21 AM
Jack
0
package assmember1; /** * * @author ASUS */ public class Members { private String name, address, memberType; private int memId, phoneNumber; private double fee; private int i, days;//this is for calculation public Members(String nm, int id, String add, int hp, double fe) { name = nm; memId = id; address = add; phoneNumber = hp; fee = fe; } public void setName(String nm) { name = nm; } public void setMemId(int id) { memId = id; } public void setAddress(String add) { address = add; } public void setPhoneNunber(int hp) { phoneNumber = hp; } public String getName() { return name; } public int getMemId() { return memId; } public String getAddress() { return address; } public int getPhoneNumber() { return phoneNumber; } public void seti(int i) { this.i = i; }
25th Mar 2020, 3:22 AM
Jack
0
public int geti() { return i; } public void setDays(int dy) { days = dy; } public int getDays() { return days; } public double getFee() { return fee; } public void calculateFee() { switch (i) { case 1: fee = 7.50 * days; break; case 2: fee = 6.00 * 30; break; case 3: fee = ((8.00 * 30) * 12) - (fee / 15 * 100); break; default: System.out.println("ERROR"); break; } } }
25th Mar 2020, 3:23 AM
Jack
0
package assmember1; /** * * @author ASUS */ public class MemberList { private Members[] member; private int count; public MemberList(int x) { member = new Members[x]; count = 0; } public void addMember(String nm, int id, String add, int hp,double fe){ member[count]= new Members(nm,id,add,hp,fe); count++; } public String toString(){ String detail=""; for(int i=0;i<count;i++){ detail=detail+" \nName: "+member[i].getName()+" \nMember Id: "+member[i].getMemId()+" \nAddress: "+member[i].getAddress()+"\nPhone Number: "+member[i].getPhoneNumber()+"\nTotal Fee To Paid: "+member[i].getFee(); } return detail; } }
25th Mar 2020, 3:23 AM
Jack