Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Java Assignment Help!

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Assignment Help!

    1st - can someone help me make a complete program contain loops, array....

    2nd - can this program combine with array? please help..

    import javax.swing.JOptionPane;
    public class excercise4_39 {
    public static void main (String[]Args){
    String commissionS = JOptionPane.showInputDialog("Enter the amount of the commission you would like to have:");
    int desiredCommission = Integer.parseInt(commissionS);
    int salesAmount = 0;
    double commissionRate = 0;
    double commissionAmount = 0;
    System.out.println("Sales Amount" + "\t\t" + "Commission Rate" + "\t\t" + "Commission Amount");

    for (salesAmount=1; salesAmount >= commissionAmount;salesAmount++){
    if(salesAmount <= 5000){
    commissionRate = 0.08;
    }
    if(salesAmount >= 5001 && salesAmount <= 10000){
    commissionRate = 0.10;
    }
    if(salesAmount >= 10000){
    commissionRate = 0.12;
    }
    salesAmount += 999;
    commissionAmount = salesAmount * commissionRate;
    System.out.println(salesAmount + "\t\t\t" + commissionRate + "\t\t\t" + commissionAmount);
    if(commissionAmount>=desiredCommission){
    break;}
    }
    JOptionPane.showMessageDialog(null, "To earn a commission amount of €" + desiredCommission + " , Your sale amount has to reach about €" + salesAmount);
    }
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Java Assignment Help!

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.

    Have you read the tutorial about loops?
    The while and do-while Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)
    The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Need help with Java assignment
    By wickedsunday in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 25th, 2012, 06:06 AM
  2. assignment troubles polymorphism (guide for assignment included)
    By tdawg422 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 8th, 2011, 11:01 AM
  3. Help with a java assignment?
    By rberry719 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: September 30th, 2011, 02:02 PM
  4. my java assignment -- please help
    By java_beginner in forum Java Theory & Questions
    Replies: 6
    Last Post: May 20th, 2010, 09:32 AM
  5. Replies: 1
    Last Post: February 22nd, 2010, 08:20 AM

Tags for this Thread