Results 1 to 10 of 10
Like Tree2Likes
  • 1 Post By masijade
  • 1 Post By gimbal2

Thread: Programming Help

  1. #1
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Programming Help

    LABORATORY EXERCISE 4: Write a Java application that calculates and displays the salary for an employee. The main( ) method prompts the user for an hourly pay rate, and hours worked. Create a separate method to calculate overtime pay which is regular hours times the pay rate plus overtime hours times 1.5 times the pay rate. Any hours worked over 40 hours is considered overtime. Also, create another method that will handle the computation of Bonus. If the employee is Regular, Bonus is Regular hours times rate per hour times * 3. If the employee is Probationary, Bonus is Rate per hour times regular hours worked times 2.Return the result to the main method to be displayed.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,535
    Blog Entries
    7
    Rep Power
    20

    Default Re: Programming Help

    Yes?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Programming Help

    Finished.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,535
    Blog Entries
    7
    Rep Power
    20

    Default Re: Programming Help

    Quote Originally Posted by masijade View Post
    Finished.
    Now please turn in the complete and fully documented code on behalf of the OP; this is a code mill after all.

    kind regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default Re: Programming Help

    Quote Originally Posted by JosAH View Post
    Now please turn in the complete and fully documented code on behalf of the OP; this is a code mill after all.

    kind regards,

    Jos ;-)
    Sorry, the dog ate it. Been spitting computer chips ever since. and don't even want to talk about what he sounds like when trying to water the car tires. ;-)
    gbonecapone likes this.

  6. #6
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Question Re: Programming Help

    Quote Originally Posted by JosAH View Post
    Now please turn in the complete and fully documented code on behalf of the OP; this is a code mill after all.

    kind regards,

    Jos ;-)
    Hey Jos! Might I ask why are there no posts on the Forum for the Java Codes? and second here's the program I did

    import javax.swing.JOptionPane;
    public class SalaryDialog
    {
    public static void main(String[] args)
    {
    String wageString, dependentString;
    double wage, weeklyPay;
    int dependents;
    final double HOURS_IN_WEEK = 37.5;
    wageString = JOptionPane.showInputDialog(null, "Enter Employer's hourly wage",
    "Salary dialog 1", JOptionPane.INFORMATION_MESSAGE);
    weeklyPay = Double.parseDouble(wageString) * HOURS_IN_WEEK;
    dependentString = JOptionPane.showInputDialog(null, "How many dependents?",
    "Salary dialog 2", JOptionPane.QUESTION_MESSAGE);
    dependents = Integer.parseInt(dependentString);
    JOptionPane.showMessageDialog(null, "Weekly Salary is $ " + weeklyPay + ". Deductions will be made for " +
    dependents + " dependents");
    }
    }

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Programming Help

    Quote Originally Posted by ITStudent View Post
    Might I ask why are there no posts on the Forum for the Java Codes?
    I think you missed the heading to the Learn Java section, where it says
    Only forum staff can post to these forums!
    The thread you started there has been removed.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Programming Help

    Quote Originally Posted by DarrylBurke View Post
    I think you missed the heading to the Learn Java section, where it says
    The thread you started there has been removed.

    db
    Yeah I totally missed that. Just created this account a week ago I think and I didn't have time to look at the forum rules etc. But thanks for informing me.

  9. #9
    ITStudent is offline Member
    Join Date
    Jul 2013
    Posts
    25
    Rep Power
    0

    Default Re: Programming Help

    Quote Originally Posted by DarrylBurke View Post
    I think you missed the heading to the Learn Java section, where it says
    The thread you started there has been removed.

    db
    Hey Darryl could you help me with this program I have. My friends did most of the codes but what they did was mostly C++ so I need to convert it to Java. BTW it has a lot of errors.
    Here's the problem:
    The history teacher at your school needs help grading a True/False Test. The students’ IDs and test answers are entered by the teacher. The first entry contains the answers to the test in the form TFFTFFTTTTFFTFTFTFTT

    Every other entry in the program is the student’s ID followed by a blank followed by the student’s response. For example, the entry: ABC54301 TFTFTFTT TFTFTFFTTFT

    indicates that the student’s ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is false and so on. This student did not answer question 9. The exam has 20 questions. Each correct answer is awarded 2 points, each wrong answer gets a -1 point. No answer gets 0 point. Write a Java program that processes the test data. The output should be the student’s ID, followed by the test score, follow by the test grade. Assume the following grade scale: 90%-100%, A; 80%-89.99%, ; 70%-79.99%, C; 60%-69.99%, D and 0%-59.99%, F.

    Additional Requirement: Create a method within your program for the determination of the test grade.

    #include <iostream>
    #include <fstream>
    #include <string>
    #include <cmath>
    public class Lab Exercise{

    using namespace std;

    const int Answers = 20;

    char getGrade(int percent);

    int main()
    {
    char answers[Answers];
    char studentAnswers[Answers + 1];
    string studentNum;
    int i;

    ifstream inFile;
    inFile.open("testdata.txt");
    ofstream outFile;
    outFile.open("Output.txt");


    for (i = 0; i < Answers; i++)
    {
    inFile.get(answers[i]);
    }

    while (!inFile.eof())
    {
    int score = 0;
    double possiblePoints = 40.0;
    double percent = 0.0;


    inFile >> studentNum;


    inFile.get();


    for (i = 0; i < Answers; i++)
    {
    inFile.get(studentAnswers[i]);
    }



    for (i = 0; i < Answers; i++)
    {
    outFile << "Correct answer: " << answers[i] << endl;
    outFile << "Student answer: " << studentAnswers[i] << endl;
    outFile << "\n" << endl;
    if (answers[i] == studentAnswers[i])
    {
    score = score + 2;
    }
    else if (answers[i] = ' ')
    {
    score = score;
    }
    else if (answers[i] != studentAnswers[i])
    {
    score = score - 1;
    }
    }


    outFile << "Student: " << studentNum << endl;
    outFile << "Answers: ";
    for (i = 0; i < Answers+1; i++)
    {
    outFile << studentAnswers[i];
    }
    outFile << "Test Score: " << score << "40" << endl;
    percent = (score / possiblePoints) * 100;
    outFile << "Percent: " << percent << "%" << endl;
    outFile << "Grade: " << getGrade(percent) << endl;

    }

    inFile.close();
    outFile.close();

    return 0;
    }


    char getGrade(int percent)
    {
    if (percent >= 90)
    return 'A';
    else if (percent >= 80)
    return 'B';
    else if (percent >= 70)
    return 'C';
    else if (percent >= 60)
    return 'D';
    else
    return 'F';
    }
    }

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Programming Help

    I think I speak for everyone when I say: you deserve to fail this subject, cheater.
    gbonecapone likes this.

Similar Threads

  1. Replies: 1
    Last Post: 04-20-2013, 09:16 PM
  2. Replies: 1
    Last Post: 04-20-2013, 09:15 PM
  3. android programming vs game programming using java
    By vgoel38 in forum Forum Lobby
    Replies: 2
    Last Post: 09-08-2012, 12:11 AM
  4. programming
    By shazeb in forum New To Java
    Replies: 9
    Last Post: 10-31-2010, 02:45 PM

Tags for this Thread

Posting Permissions

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