Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Other Methods of FREE Advertising > Guest Books Directory

Guest Books Directory Here is a great way to get some inbound links to your site, and message heard by people who also post and read these books. (Tip: Dont use your real email address on them)

Reply
 
Thread Tools Search this Thread Display Modes
Old 05-06-2011, 12:12 PM   #1
baby6899
 
Posts: n/a
Default Office Professional 2007 Buy Laptop Buy Notebook

Subscribe by means of RSS
Get Laptop | Notebook | Netbook
Buy Laptop computer | Notebook | Netbook from Top Manufacturers : Acer,Office Standard 2007 Key, Sony, Toshiba, Apple Macbook, Dell, Lenovo, Hewlet Packard, Fujitsu

Question by Jaix: Write a plan in Java to get a income file system that computes and prints the discount for a item?
I’m new to java but i’m sorta stuck! The program should choose from four items. Based on the quantity ordered, if the quantity is 20 )

discount = 15 / 100 * itemPrice;
else if( order = 11 )

discount = 10 / 100 * itemPrice;
else if( order = 6 )

discount = 5 / 10 * itemPrice;
else

discount = 0;
return low cost;
}
public double calculateAmount()
double amount;
amount = itemPrice – discount;
return amount;
}
The main method code:
/*
* To change this template,Windows 7 Starter Key, choose Tools | Templates
* and open the template in the editor.
*/
package salesrecord;
import java.util.Scanner;
/**
*
* @author Jikes
*/
public class SalesRecordTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int itemNumber = 0;
int quantity;
String itemName = “”;
double price = 0;
Scanner input = new Scanner( System.in );
System.out.println( “CURRENT ITEMS IN STOCK ARE LISTED BELOW:\n” );
System.out.println( “Item Number\t Item Name” );
System.out.println( “1)\t\t Dell 15\” Laptop\n2)\t\t HP Mini NoteBook\n3)\t\t Sony VIAO 12\” Tablet\n4)\t\t Apple MacBook Air” );
System.out.print( “\nEnter Desired Item Number: ” );
itemNumber = input.nextInt();
if( itemNumber == 1 )

price = 500;
itemName = “Dell Laptop”;
System.out.println( “You selected Dell 15\” Laptop\n” );
else if( itemNumber == 2 )

price = 400;
itemName = “HP NoteBook”;
System.out.println( “You selected HP Mini NoteBook\n” );
else if( itemNumber == 3 )

price = 800;
itemName = “Sony Tablet”;
System.out.println( “You selected Sony VIAO 12\” Tablet\n” );
else if( itemNumber == 4 )

price = 1300;
itemName = “MacBook Air”;
System.out.println( “You selected Apple MacBook Air\n” );
else

System.out.println( “Invalid Item Number Entered!” );
Technique.out.print( “Enter Desired Quantity: ” );
quantity = input.nextInt();
SalesRecord mySalesRecord = new SalesRecord( price );
Technique.out.println();
Method.out.println( “ITEM NUMBER\tITEM NAME\tQUANTITY\tPRICE ($ )\tDISCOUNT ($ )\tAMOUNT ($ )\n” );
Technique.out.printf( “%d\t\t%s\t%d\t\t%.2f\t%.2f\t\t%.2f\n\n”, itemNumber, itemName, quantity, mySalesRecord.getItemPrice(),
mySalesRecord.calculateDiscount( quantity ),microsoft Office 2010 License, mySalesRecord.calculateAmount() );
Program.out.println( “Thank you for Shopping with us,Office Professional 2007!” );
}
}
Best answer:
Answer by Sayee
First, Thanks for the question,Office Professional Plus 2010 Key! It took about 10 min before I spotted the mistake!
when using double
don’t do low cost = 5 / 10 * itemPrice;
USE low cost = 5.0 / 10.0 * itemPrice;
change all numbers with an extra .0 in all the calculation lines similar to above and it should work fine!
Hope it helps.
What do you think? Answer below!
  Reply With Quote

Sponsored Links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:51 PM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum