Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Tim Cooke
Sheriffs:
Rob Spoor
Liutauras Vilda
paul wheaton
Saloon Keepers:
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Piet Souris
Bartenders:
Stephan van Hulst
Forum:
Beginning Java
Writing an application class?
Joe Grimp
Greenhorn
Posts: 15
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I have the Date and Transaction class and i need to
test
them so i have to write an application class. How do i go about doing this?
Here is the transaction class -
class Transaction { private double amount; private double newBalance; private boolean type; private Date d; public void readTransaction() { char c; d = new Date(); d.readDate(); do { System.out.print("Is this transaction a withdrawal or deposit? (W or D)"); c = uuInOut.ReadChar(); uuInOut.ReadLn(); if (c != 'W' && c != 'w' && c != 'D' && c != 'd') System.out.println("Invalid entry. Try again."); }while (c != 'W' && c != 'w' && c != 'D' && c != 'd'); if (c == 'W' || c =='w') type = true; else type = false; System.out.print("Enter amount: "); amount = uuInOut.ReadDouble(); } public void printTransaction() { d.printDate(); System.out.print("\t" +amount); if(newBalance < 0) { System.out.print(-newBalance +"OD"); } System.out.println("\t" +type); } public boolean getType() { return type; } public double getAmount() { return amount; } public void setBalance(double value) { newBalance = value; } }
Oscar Gonzalez
Ranch Hand
Posts: 63
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can use
JUnit
, as a
Java
programmer you will want to use TestCases to test your code.
www.junit.org
Joe Grimp
Greenhorn
Posts: 15
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How do i install the Junit thing... i can't follow the installation guidelines on the website, thanks.
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
return Boolean
New to Java - i need help please!
How to get a transfer function to work both ways?
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Class and Object Problem
More...