+ 4

Excuse me,could someone tell me why the program shows "Null".Please me🙏🙏

class Account{ private String name; private String no; private int balance; Account(String n, String num, int t){ n=name; num=no; t=balance; } String getname(){ return name; } String getnumber(){ return no; } int getbalance(){ return balance; } void withdraw(int k){ balance+=k; } void deposit(int v){ balance+=v;} } class AccountTester{ public static void main(String[]args){ Account Andrew = new Account("Andrew", "123456", 1000); Account Marry = new Account("Marry", "654321", 200); Andrew.withdraw(200); Marry.deposit(100); System.out.println("The account of Andrew"); System.out.println("The name of Andrew account:" + Andrew.getname()); System.out.println("No of Account:" + Andrew.getnumber()); System.out.println("The rest of money:" +Andrew.getbalance()); System.out.println("The account of Marry"); System.out.println("The name of Andrew account:" + Marry.getname()); System.out.println("No of Account:" + Marry.getnu

8th Jul 2018, 2:40 AM
Hunt
Hunt - avatar
24 Antworten
+ 1
Oh see you once again.Amazing,thanks my friend😄
8th Jul 2018, 12:03 PM
Hunt
Hunt - avatar
+ 1
name,no,balance this are your class data members and n,num,t are the parameters of constructor which you have to assign to class data members.
9th Jul 2018, 3:27 PM
Tarika
Tarika - avatar
+ 1
sure
9th Jul 2018, 3:30 PM
Tarika
Tarika - avatar
+ 1
what is it?
9th Jul 2018, 3:34 PM
Tarika
Tarika - avatar
+ 1
sorry , i don't know , i m new here
9th Jul 2018, 3:38 PM
Tarika
Tarika - avatar
+ 1
noah , what is wrong with your code? is it running?
9th Jul 2018, 3:41 PM
Tarika
Tarika - avatar
+ 1
do it , then
9th Jul 2018, 3:43 PM
Tarika
Tarika - avatar
+ 1
i have checked , i don't see any problem
9th Jul 2018, 3:43 PM
Tarika
Tarika - avatar
+ 1
whats the problem ?
9th Jul 2018, 3:49 PM
Tarika
Tarika - avatar
+ 1
that's funny :) :) :)
9th Jul 2018, 4:08 PM
Tarika
Tarika - avatar
0
Ace,Could you help me to figure out a problem about java? I want to post my program on soloLearn ,but the words amount of my program over the words limitation at the Q&A so i can not post that over there. If you do not mind,may i find you in "Discord" communication software?😁
9th Jul 2018, 2:53 PM
Hunt
Hunt - avatar
0
Thank you,i have dealed with this program,could you help me for another program about java too?
9th Jul 2018, 3:29 PM
Hunt
Hunt - avatar
0
I want to post another program on soloLearn ,but the words amount of my program over the words limitation at the Q&A so i can not post that over there. If you do not mind,may i find you in "Discord" communication software?😁
9th Jul 2018, 3:31 PM
Hunt
Hunt - avatar
0
The communication application of SoloLearn
9th Jul 2018, 3:36 PM
Hunt
Hunt - avatar
0
import java.util.Scanner; class Car{ private String name; private int width; private int height; private int length; private double x; private double y; private double fuel; Car(String name,int width,int height,int length,double fuel){ this.name=name; this.width=width; this.height=height; this.length=length; this.fuel=fuel; x=y=0.0; } double getX() {return x;} double getY() {return y;} double getFuel() {return fuel;} void putSpec() { System.out.println("The name of the car : " + name ); System.out.println("The width of the car : " + width +"mm"); System.out.println("The height of the car : " + height + "mm" ); System.out.println("The length of the car : " + length + "mm"); } boolean move(double dx, double dy) { double dist = Math.sqrt(dx * dx + dy * dy); if(dist>fuel) return false; else{ fuel-=dist; x +=dx; y +=dy; return true; } } } class CarTester{ Scanner stdin =new Scanner(System.in); System.out.println("Please
9th Jul 2018, 3:39 PM
Hunt
Hunt - avatar
0
See,there is not enough space to post my program
9th Jul 2018, 3:39 PM
Hunt
Hunt - avatar
0
Do you play wechat?
9th Jul 2018, 3:40 PM
Hunt
Hunt - avatar
0
I know how to do,i can post two part of the program over here
9th Jul 2018, 3:43 PM
Hunt
Hunt - avatar
0
import java.util.Scanner; class Car{ private String name; private int width; private int height; private int length; private double x; private double y; private double fuel; Car(String name,int width,int height,int length,double fuel){ this.name=name; this.width=width; this.height=height; this.length=length; this.fuel=fuel; x=y=0.0; } double getX() {return x;} double getY() {return y;} double getFuel() {return fuel;} void putSpec() { System.out.println("The name of the car : " + name ); System.out.println("The width of the car : " + width +"mm"); System.out.println("The height of the car : " + height + "mm" ); System.out.println("The length of the car : " + length + "mm"); } boolean move(double dx, double dy) { double dist = Math.sqrt(dx * dx + dy * dy); if(dist>fuel) return false; else{ fuel-=dist; x +=dx; y +=dy; return true; } } } (part 1)
9th Jul 2018, 3:46 PM
Hunt
Hunt - avatar
0
class CarTester{ Scanner stdin =new Scanner(System.in); System.out.println("Please input the name: "); String name=stdin.next(); System.out.println("Please input the value of width: "); int width=stdin.nextInt(); System.out.println("Please input the value of heigth: "); int height=stdin.nextInt(); System.out.println("Please input the value of length: "); int length=stdin.nextInt(); System.out.println("Please input the value of fuel: "); double fuel=stdin.nextDouble(); Car myCar = new Car(name,width,height,length,fuel); (part 2)
9th Jul 2018, 3:47 PM
Hunt
Hunt - avatar