Help Me Please......
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.
Help Me Please......
Please no attachments. Copy the text and paste it here.
If you don't understand my answer, don't ignore it, ask a question.
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;
Sorry, I have no idea what you are asking. Please explain what problems you are having.overwritting this coding
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.
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.
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.
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) )
}
Please explain.problem over there.
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.