Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
programming sem 2 year 1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
daniel.tang
programming sem 2 year 1
Commits
69efa880
Commit
69efa880
authored
Jan 27, 2020
by
daniel.tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
3335a825
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
threePints.java
Week 1/threePints/threePints.java
+36
-0
No files found.
Week 1/threePints/threePints.java
0 → 100644
View file @
69efa880
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment