MedVision ad

coding problem (1 Viewer)

puffkenny

******
Joined
Sep 13, 2003
Messages
228
Gender
Female
HSC
1999
hi, my code are as follows:

public double increaseBalance(double increment)
{
balance = balance + increment;
balance = balance * 0.99;
return balance;
System.out.println();
}

ok, my problem lies within the line System.out.println(); where i would have the system to display the amount of "balance" present. how can i do that? what would i put in the ()?
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
you doing SOFT 1001? lol i finished my assy 1 and handed it in already

anyways


what you put inside the parenthisis is what you want to print

so the line would be

System.out.println(balance);

which would print the actual balance.
 

puffkenny

******
Joined
Sep 13, 2003
Messages
228
Gender
Female
HSC
1999
thanks winston!!
ok, now if i want to enhance that line by adding like "your current balance holds: (balance)" how would i do that?
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
System.out.println("Your current balance holds: " + balance);

Where + acts as the concatenator, it joins strings together, strictly to say balance isn't of type String anyways, but when that occurs, the + operator forces a type conversion of the balance from double to a string.
 

puffkenny

******
Joined
Sep 13, 2003
Messages
228
Gender
Female
HSC
1999
GREAT!!!! thanks dude!!!
I think somebody cursed me to be stupid when I entered this course, my brain just don't seem to function around JAVA lol.
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by puffkenny
GREAT!!!! thanks dude!!!
I think somebody cursed me to be stupid when I entered this course, my brain just don't seem to function around JAVA lol.
Yeah same me... then i realised this is programming not maths lol... i'm moving to 1901 tommorow yay :D... are you in 1001? and why are you doing SOFT anyways? :S
 

puffkenny

******
Joined
Sep 13, 2003
Messages
228
Gender
Female
HSC
1999
congrats on moving into the advanced stream!!
yeh, I'm in 1001, y am i doing so? I want to do computer as a part of my double degree along with commerce. So when I come out after 5 years, I'll hopefully have a good career prospect as the two course are related in the future. :D
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by puffkenny
congrats on moving into the advanced stream!!
yeh, I'm in 1001, y am i doing so? I want to do computer as a part of my double degree along with commerce. So when I come out after 5 years, I'll hopefully have a good career prospect as the two course are related in the future. :D
thanks
ahhh ok sounds good to me, :D broadening your horizions, i'm locked into computers lol ah well.
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by freaking_out
hehe, well if u don't find a job- u can always bcome a "proper" sdd/ipt teacher. :lol:
and fuck up peoples HSC :D
 

freaking_out

Saddam's new life
Joined
Sep 5, 2002
Messages
6,786
Location
In an underground bunker
Gender
Male
HSC
2003
Originally posted by Carlito
Dont you need a teaching degree for that
yeah, u just need to do an extra year on top of ya comp. science and u can bcome a teacher- thats what a freind of mine (who's in third year comp. science) is gonna do, and he said that lots of his class mates are gonna do the same, since there are no jobs at the moment.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top