Commit 69efa880 authored by daniel.tang's avatar daniel.tang

Upload New File

parent 3335a825
package programmingP2week1;
public class threePints {
public static void main(String[] args) {
// TODO Auto-generated method stub
double cost = 2.50;
Student fred = new Student();
fred.moneyInPocket = 20;
fred.buyDrink = 3;
fred.totalA = fred.buyDrink * cost;
fred.totalB = fred.moneyInPocket - fred.totalA;
System.out.println("Fred final balance " + fred.totalB);
Student jim = new Student();
jim.moneyInPocket = 40;
jim.buyDrink = 2;
jim.totalA = jim.buyDrink * cost;
jim.totalB = jim.moneyInPocket - jim.totalA;
System.out.println("Jim final balance " + jim.totalB);
Student sheila = new Student();
sheila.moneyInPocket = 60;
sheila.buyDrink = 3;
sheila.totalA = sheila.buyDrink * cost;
sheila.totalB = sheila.moneyInPocket - sheila.totalA;
System.out.println("Sheila final balance " + sheila.totalB);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment