Results 1 to 3 of 3
  1. #1
    melissahassle is offline Member
    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Default 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();

    System.out.println("Please enter you name:\n");
    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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    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

  3. #3
    gcampton Guest

    Default

    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:
    /****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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •