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

Thread: What should I do next??

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

    Default What should I do next??

    My assignment:

    Assignment Background:

    Billionaire Donaldio Trumpola has hired you to help him run his many businesses. He has so many staff members in so many different companies that he is losing track of them all. What he would like you to do, is write a program, that he can use to enter in the information about his companies. He will want to input the following information for each department:

    Department Name:
    Employees:
    Cost Per Employee:
    Sales:

    Below is the data he would like you to enter (you didn't think he would enter it himself did you?) Write your program to handle the amount of information that needs to be inputted. You do not need to use a loop, you can simply have multiple requests to ".readLine()" .

    Finally, Donaldio would like your program to use all the information inputted to find out if he has made any money, or if he is bankrupt. Calculate the cost to run each department, and compare that to the sales for the department, come up with a total, and present all your numbers in a nice output that has been formatted - using the technique you have learned in the notes - to show money with two decimal places, comma's and a dollar sign. In the output you should present the statistics for each department, and the statistic for all departments.

    Here is the Data:

    Department Name: Cool Casino
    # of Employees: 543
    Cost Per Employee: 0.75
    Sales: 1000.432

    Department Name: Trumpola Burgers
    # of Employees: 43
    Cost Per Employee: 19.725
    Sales: 50

    Department Name: Donoldio Clothing for Cats
    # of Employees: 4.0001
    Cost Per Employee: 5.233
    Sales: 100

    Department Name: Trumpola Leaning Tower
    # of Employees: 1003
    Cost Per Employee: 1.2123
    Sales: 704.67

    Bonus: Use a loop to ask how many departments Donaldio would like entered and then loop through that many requests!

    I have written down the code:
    import java.util.*;
    import java.io.*;

    public class Business
    {
    public static void main (String[]args) throws IOException
    {
    String department;
    BufferedReader in;
    in = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Department Name:");
    department = in.readLine();
    System.out.println("Department Name: "+department);

    String employees;
    BufferedReader em;
    em = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Employees:");
    employees = in.readLine();
    System.out.println("Employees: "+employees);

    String cost;
    BufferedReader co;
    co = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Cost per Employee:");
    cost = in.readLine();
    System.out.println("Cost per Employee: "+cost);

    String sales;
    BufferedReader sa;
    sa = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Sales:");
    sales = in.readLine();
    System.out.println("Sales: "+sales);
    }
    }

    What should I do next?? I can input the information given above, however, I need to type "java Business" in order to enter the 2nd information. Can I do it within one program??

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: What should I do next??

    When posting code, please use the highlight tags to preserve formatting.

    So, what's your question? You've dumped your assignment here, but which part is giving you trouble? I suggest reading through the java tutorial (not to mention your class notes and book) to get an idea of the kinds of control statements you have at your disposal.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What should I do next??

    So I have now created a code...... How can I enter all the information in one code??

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What should I do next??

    Can you rephrase your question? What information? Are you using an editor to enter information into a file?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    May 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What should I do next??

    Like.... this is the right code that I can input one set of data. However, is there a way that I can input all data within one code?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: What should I do next??

    is there a way that I can input all data within one code?
    Can you explain what you mean by "input all data"?
    You can have the program ask many questions of the user and read his responses into variables in the program.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: What should I do next??

    This is the third time you're simply dumping your homework assignment here. Stop doing that.

    I highly recommend you read the link in my signature on asking questions the smart way, then provide an SSCCE and ask a specific question.

    Further homework dumps will get you banned.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!