Java Programming... need help pls

ecyor07

New Member
Hi guys, Im new in java programming so could you please help me build a program.
The program goes like this:
I need a program in accounting(A program for a cashier). The program asks the user to enter the AMOUNT of an item. A 6 percent tax will be added to the amount of the item. The program will ask the user how much will he pay. Then the program will display the change.
The final output of the program should be like this:

Amount of the Item: $_____
Tax: $_____
Total Amount: $_____
Amount Tendered: $______
Change:$______

The Attributes and methods to be used are:
double cost,tax,payment;
double getCost()
double getTax()
double getPayment()
void setCost(double x)
void setTax(double x)
void setPayment(double x)

It should only use java.io.*; Nothing else. Kindly help please. just give me a simple code for this program. (Newbie Code only because I cannot understand Advance codes). Thanx guys! you can also email me at royce_adam@yahoo.com Thanx again and good luck! (to me):)
 
What part specifically are you having trouble with? We aren't going to write your program for you but we'd be happy to help with certain parts you are having trouble with.
 
This is baby stuff, the simplest of programming, if you couldn't figure out how to do it on your own I strongly advise you to stop learning programming and start finding something else you think you'll be good at.
So try to figure it out, write some code and if you get errors post your code here and we can help you with your errors.
 
I don't know Java but here's a Python script I just wrote to do exactly the same thing, hopefully you can read it and at least figure out how the program should flow. I don't know Java but it shouldn't be hard to read this python and figure out what it's doing.

cost = input("Amount of the Item: $")
cost = round(cost, 2)
tax = cost * .06
tax = round(tax, 2)
print "Tax: $", tax
due = tax + cost
due = round(due, 2)
print "Total Amount: $", due
payment = input("Amount tendered: $")
payment = round(payment, 2)
change = payment - due
print "Change: $", change

Also I agree with Shady, this is such baby stuff that this script here is the first time I've programmed anything more complicated than a hello world, and I had a program that did what I wanted in two minutes. (Although, it is just python, and I've known for years how programming worked, I just never bothered to do anything with it.)
 
Back
Top