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 8 of 8

Thread: Need Help Here

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Need Help Here

    Help Me Please......
    Attached Images Attached Images

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,661
    Thanks
    45
    Thanked 1,960 Times in 1,934 Posts

    Default Re: Need Help Here

    Please no attachments. Copy the text and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Need Help Here

    i Try to overwritting this coding, but i find out that i can do it.Please help me


    int counter =0; // counter need to initialized to 0
    int a = 10;
    int b = 11;
    int c = 15;
    int d = 0;
    String outputla="You have select 1 item\n Your total is RM"+d;
    String menu="(1) Coffee Late\t\tRM10.00\n(2) Mocha\t\tRM11.00\n(3) Green Tea Late\ String str;
    while (counter<3)(
    // counter < 3
    str=JOptionPane.showInputDialog(null,menu, "Example", JOptionPane.QUESTION_MESSAGE int x = Integer.parselnt(str);
    if (x==1)(
    // here doesn't need to put counter ==2 ?
    d = d+a;
    JOptionPane.showMessageDialog(null,"You Have Purchase" + counter + "times \n P
    //here should end with } for x ==1
    if (x==2)(
    // here should start with another condition for x == 2( 1
    d = d + b;
    JOptionPane.showMessageDialog(null,"You Have Purchase" + counter + "times
    if (x==3)(
    // here also same need to start with a condiiton d = d + c;

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,661
    Thanks
    45
    Thanked 1,960 Times in 1,934 Posts

    Default Re: Need Help Here

    overwritting this coding
    Sorry, I have no idea what you are asking. Please explain what problems you are having.

    Please edit your post and wrap your code with code tags:
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Need Help Here

    i try to make this code fix in my question. but i can't do it.

    Norm can you recommend some book for me. i'm a newbies and fresh. i try to learn this Java.
    and i did't have any basic on this java.TQ Norm
    the question i already attach in the first comment.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,661
    Thanks
    45
    Thanked 1,960 Times in 1,934 Posts

    Default Re: Need Help Here

    Sorry, I don't know of any good java books.

    You need to explain what problems you are having with the code.

    Also the code needs to be wrapped in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Need Help Here

    This is the code i try to do it,but i some problem over there.


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package javaapplication1;
    import java.util.Scanner;
    import javax.swing.JOptionPane;
    /**
    *
    * @author student
    */
    public class Main {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    double price1=29.0;
    double price2=39.0;
    double price3=49.0;
    double total=0.0;
    int item=0;
    Scanner input = new Scanner (System.in);
    int counter = 0;
    int select;
    do{
    System.out.print("Enter ther selection: ");
    select = Input.nextint();
    if (select==1);
    total=total+price1
    else if(select == 2);
    total=total+price2
    else if(select == 3);
    total=total+price3
    else if (select==0)
    break;
    Counter++;
    item++
    System.out.println("You have selected" + item + "item with "
    while(counter<4);
    system.out.println(String.format("%3", total) )

    }

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,661
    Thanks
    45
    Thanked 1,960 Times in 1,934 Posts

    Default Re: Need Help Here

    problem over there.
    Please explain.

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.