Results 1 to 5 of 5
Thread: can someone help me code this?
- 04-23-2009, 11:28 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
can someone help me code this?
prompt the user to the number of products purchased
prompt the user to enter the name of each product and its price
calculate the total cost of the products
if the total cost of the products is between £10 and £25 the user gets a 5% discount, if the total cost is between £25 and £40 pounds they get a 7.5% and if the purchases cost more than £40 they get a 10% discount
prompt the user to enter amount tendered
calculate the change
write the names and prices of products, discount, amount tendered and change owed to customer to a file
read the details written to the file onto the screen
these are my specifications
i'm pretty new to java and completely stuck...
- 04-23-2009, 11:31 AM #2
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
1. start LOOP
2. GET number of products purchased
3. GET information about product
3.1 GET name of product
3.2 GET price of product
3.3. end LOOP
4. IF total cost of product is between £10-£25 THEN 5% discount
4.1 IF total cost of product is between £25-£40 THEN 7.5% discount
4.2 IF total cost of product is 40> THEN 10% discount
5. GET amount tendered
6. Calculate change
7. INPUT: price of products, discount, amount tendered and change owed.
8. OUTPUT: price of products, discount, amount tendered and change owed.
9. end
- 04-23-2009, 04:29 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 32
- Rep Power
- 0
u must give a try...then if u have problems post ur code and errors u get...
- 04-23-2009, 04:50 PM #4
Member
- Join Date
- Apr 2009
- Location
- Brisbane
- Posts
- 86
- Rep Power
- 0
package ryzii;
HTH. Keith.Java Code:class Purchases { public static void main(String[] args) { try { Purchases purchases = new Purchases(); .... your main method code goes here .... .... it says what needs to happen not how .... } catch (Exception e) { e.printStackTrace(); } } .... some cool helper methods go here .... .... each method defines how a specifc task is performed .... .... for instance .... // prompt the user to enter the number of products purchased private static int readNumProducts() { String prompt = "please enter the number of products purchased : "; return Integer.parseInt(console.readLine(prompt)); } }Last edited by corlettk; 04-23-2009 at 04:51 PM. Reason: frog got the code tags!
- 04-24-2009, 03:08 PM #5
Member
- Join Date
- Apr 2009
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Why doesn't this code accept my code?
By PeterFeng in forum New To JavaReplies: 5Last Post: 02-03-2009, 01:39 PM -
I need help fixing my code.. or non code?
By MrHuggykins in forum New To JavaReplies: 1Last Post: 03-19-2008, 10:12 PM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks