Win a copy of The Java Performance Companion this week in the Performance forum!

# help needed with questions

tony edward
Greenhorn
Posts: 1

it would mean a lot to me.

Question 1:
The ALL-IN-ONE STORE needs to increase the price of all items by 7,5%. Prompt the user to enter the item number and also to enter the item current price. Calculate the new price and display the item number and the new price. Example:
Enter the item number:
89VF34
Enter the item price:
24.34
Item number = 89VF34
New item price = 26.1655
[5]

Question 2:
Write a Java application that prompt the user to enter the price of fuel per liter, the distance in kilometers traveled and the distance the car travels per liter. Calculate and display the cost of the fuel for the distance traveled. Example:
Enter the price of fuel per liter:
4.51
Enter the distance in km traveled:
45
Enter the distance the car travels per liter:
13
The cost of fuel for the distance traveled = R15.6115384
[10]

Question 3:
Write a Java application that prompts the user to enter John�s gross monthly salary. The pension fund contribution is 8% of his salary. The tax takes 20% of his taxable salary (gross salary � pension) and he pays R425 for medical aid. Display his gross salary, total deductions and net salary.
[15]

Junilu Lacar
Bartender
Posts: 7480
50
If you have any specific questions regarding the programs that you are writing to solve these, we'd be glad to help. Apart from that, we're usually not in the habit of doing people's homework for them. Sorry.

celine mcgowan
Ranch Hand
Posts: 36
Hi Tony,

Junilu is right - no-one will do your homework for you. But don't be too disappointed - it's a ploy they have here to make you learn Java!!! Anywho, the problems you have are simple enough - as long as you know where to start...

So, go to your local library (or maybe look at your Java course notes!) and find out how to write a very simple class in Java. Then find out how to do maths in Java. Once the maths is finished, most of your work is done. Just one more step - you'll need to know how to get input from the user & how to return output to the user. Any good java book or set of notes will cover these topics in the first couple of chapters/sections.

Build what you do up slowly but surely & you'll be amazed how quickly you get there. If you get stuck the people here are really, really helpful so post any questions you like!!!

Good luck with it!
Celine

Mike Gershman
Ranch Hand
Posts: 1272
You said that these were exam questions.

The teachers must be pretty liberal down there (you do realize that they read this board too).