# Can someone help me with this ?

• 10-11-2009, 03:42 AM
melissahassle
Can someone help me with this ?
import java.util.Scanner;

public class BasicConversions{

public static void main(String[] args){

/* There are four exercises to complete. Instructions for completing these are indicated in the comments above each
The comments below each exerice will indicate the correct output.
Your job is to fill in the code to generate that ouput. Each exercise should output on a separate line. Good luck! */

/****EXERCISE 1:
Complete this code to perform the arithmetic of a*b=c below. The answer should be stored in the variable named c */

int a,b,c;
a=5;
b=6;

System.out.println("Exercise 1: " + c);

//The exercise should output "Exercise 1: 30" to the console

/****EXERCISE 2:
Complete the code below to output the variable cashMoney in dollar format. */

Double cashMoney= 2.39;

//The exercise should output "Exercise 2: \$2.39" to the console

/****EXERCISE 3:
Complete this code to perform the arithmetic below. The answer should be stored in a variable named total */

int hours=5;
Double rate=13.49;

//The exercise should output "Exercise 3: \$67.45" to the console

/****EXERCISE 4:
Complete the code below to input and output from a prompt */

Scanner in = new Scanner(System.in);
String myName=new String();

myName=in.nextLine();

//The exercise should output "Exercise 4: yourname" to the console, where yourname is the name input by the user */

} //end class Main

} //end class BasicConversions
• 10-11-2009, 03:52 AM
Fubarable
So in essence what you've done is to give us your entire assignment without asking a question, and I'm afraid that in this situation there's not much that we can do for you. I suggest that you post your best solution that you've created so far, and ask as specific questions as possible, and we'll be much better able to help. If you really have no idea how to begin here, then please have a look here: Starting Writing a Program. It's a well-written article that can help.

Much luck
• 10-11-2009, 09:51 AM
gcampton
Like Fubarable has already mentioned you really ened to at least attempt stuff instead of getting other people to do it for you. for example:
Quote:

/****EXERCISE 1:
Complete this code to perform the arithmetic of a*b=c below. The answer should be stored in the variable named c */

int a,b,c;
a=5;
b=6;

System.out.println("Exercise 1: " + c);
if a=5 and b=6 and the output of c needs to be 30 what should c be??
it's simple math, and the answer is not c=30... in fact the answer has already been given to you in the comment...

You must be very careful when posting to forums to ask specific questions about problems you are encountering not getting people to do your work for you as this can lead to you getting expelled from the university / Tafe / Institute you are studying with an auto fail against your name.

And it generally annoys people who are here to help others.