Question

Create one program using these three programs: 1. Payroll Calculator Need to include state tax amount...

Create one program using these three programs:

1. Payroll Calculator


Need to include state tax amount and SS amount

Net pay need to reflect those amount

Need to make all the amounts with 2 decimal points. Hint See line #31

- Use the programming outline/format discussed in the lecture, with proper documentation, data declaration, etc.

- When asking a user for data, provide user-friendly and clear direction
- Same thing for the output.
- Include code and screenshot of the program & output in MS Word and submit

Input

Ask the user, his/her first name.

Ask for a number of hours worked

Process

Set pay rate as a constant, $30 per hour

Set Fed tax rate as a constant, 15%

Set State tax rate as constant, 5%

Set Social Security Tax as constant, 7%

Find gross pay

Find taxes

Find net pay = gross pay – taxes

Output

Display name, taxes, and net pay

2. Grade Calculator

Input

Ask for user’s name

Ask for 4 exam grades

Ask for 3 programming assignment grades

Process

4 exams, worth 100 points each, worth 60% of overall grade

3 programming assignments, worth 10 point each, worth 40% of overall grade

The overall grade can be calculated as 0.6 * averageExamScore + 0.4 * averageProgScore.

Output

User’s name

Average exam score

Average programming assignment grade

Overall course grade

Note:

Format your output numbers to 2 decimal points

3. Rock Paper Scissors

Write a rock, paper, scissors program that

A user plays with a computer

Use r, p, s for user input choice of rock, paper, scissors

Best out of 7 wins: whoever wins 4 times first wins the game

Provide standard documentation and comments

Submit code and screenshots in MS Word

IPO

Input

Ask user for a choice

Process

Randomly select a computer choice

Decide who won

Keep track of score

Repeat until either side wins 4 times

Incorporate invalid inputs and provide appropriate message to a user

When a game is finished, ask if user wants to play again if so, repeat the game

Provide the winner and score every time a game is played

Output

The winner

Provide the score for each (how many time each side won)

Basically, write a program that incorporates 3 programs from the above list into one large program. So, pick 3 programs you want to incorporate

Outline

Display 3 programs for users to see and pick from or to quit

Ask a user to choose which of the 3 programs he/she want to do

Call that program as a function and let the user go through the program

when the user is finished, return to the main program

Example/Sample

It doesn’t have to be like this but something like this would work

Display

Please choose from one of the following options

T – Temperature converter

R – Rock, paper, and scissors game

D – Draw different geometric figures

Q – quit

Check what user’s selection is

If selection is T then call program/function T….

But use a While loop

Your program must compile without successfully

***MUST BE IN PYTHON***

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

code is self explaned

import random
def payrollCalculator():

    name = input('Enter your First name: ');
    number_of_hour = float(input('Enter number of hour'))
    pay_rate = 30
    fed_tax_rate = 15
    state_tax_rate = 5
    social_security_tex = 7
    gross_pay = 30 * number_of_hour
    taxes = gross_pay * .27
    net_pay = gross_pay - taxes

    print('Name: {0} taxes: {1:.2f} net pay: {2:.2f}'.format(name,taxes,net_pay))

def gradeCalculator():
    usrname = input('Enter username: ')
    exam_grades = 0
    programming_grades = 0
    for i in range(4):
        exam_grades += int(input('Enter exam {0} Grade: '.format(i+1)))
    for i in range(3):
        programming_grades += int(input('Enter Programming {0} Grade: '.format(i + 1)))
    averageExamScore = exam_grades / 4
    averageProgScore = programming_grades / 3

    overall_grade = 0.6 * averageExamScore + 0.4 * averageProgScore
    print('Username: {0}\n Average exam score: {1:.2f}\n Average programming assignment grade: {2:.2f}\nOverall course grade: {3:.2f}'.format(usrname,averageExamScore,averageProgScore,overall_grade))

def rockPaperScissors():
    choice = ['r', 'p', 's']
    key_winner = {"user":0,"computer":0}
    while True:
        user_score = 0
        cmp_score = 0
        for i in range(7):
            random_choice = choice[random.randint(0, 2)]
            usr_choice = input('Enter [r for Rock ] [p for paper] and [s for scissors]  ')
            cmp_choice = choice[random.randint(0, 2)]
            if random_choice.upper() == usr_choice.upper():
                user_score += 1
                print('you selected {0} and  random value is {1} you win for now '.format(usr_choice, random_choice))
            else:
                print('you selected {0} and  random value is {1} you loss for now '.format(usr_choice,random_choice))
            if random_choice.upper() == cmp_choice.upper():
                cmp_score += 1
                print('computer selected {0} and  random value is {1} you win for now '.format(cmp_choice, random_choice))
            else:
                print('computer selected {0} and  random value is {1} you loss for now '.format(cmp_choice, random_choice))

        if cmp_score >= 4 :
            print('Computer Win!!')
            key_winner["user"] = key_winner["user"] + 1
        elif user_score >= 4:
            print('User Win!!')
            key_winner["computer"] = key_winner["computer"] + 1
        print('User win {0} times and computer win {1}'.format(key_winner["user"],key_winner["computer"]))
        c = input('want to play again y/n')
        if c is 'n':
            break

if __name__ == '__main__':
    choice = '''Please choose from one of the following options

                P – Pay roll Calculator

                R – Rock, paper, and scissors game

                G – Grade Calculator

                Q – quit: '''
    while True:
        c = input(choice)
        if c.upper() == 'P':
            payrollCalculator()
        elif c.upper() == 'R':
            rockPaperScissors()
        elif c.upper() == 'G':
            gradeCalculator()
        elif c.upper() == 'Q':
            break

for any query ask in the comment

Add a comment
Know the answer?
Add Answer to:
Create one program using these three programs: 1. Payroll Calculator Need to include state tax amount...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN JAVA. Write a program that lets the user play the game of Rock, Paper, Scissors...

    IN JAVA. Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet....

  • (Java) Write a program that lets the user play the game of Rock, Paper, Scissors against...

    (Java) Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. Don’t display the computer’s choice yet. The...

  • C++ Part 2: Rock Paper Scissors Game Write a program that lets the user play this...

    C++ Part 2: Rock Paper Scissors Game Write a program that lets the user play this game against the computer. The program should work as follows: When the program begins, a random number between 1 and 3 is generated. If the number is 1, the computer has chosen rock. If the number is 2, the computer has chosen paper. If the number is 3, the computer has chosen scissors. Don't display the computer's choice yet. Use a menu to display...

  • Write this program using C++ , (Rock, Paper, Scissors Game – Page 373) This programming assignment...

    Write this program using C++ , (Rock, Paper, Scissors Game – Page 373) This programming assignment is from the textbook with some slight modifications and clarifications. Here is what I am going to except from you. Your program should include at least the following functions: getComputerGuess(): this function should return a random value generated by the computer using rand function (read more about random numbers in Chapter 3 pages 126 – 128). getUsersChoice(): this function will ask the user to...

  • For this week’s assignment, we will be recreating the Rock, Paper, Scissors program using Object-...

    For this week’s assignment, we will be recreating the Rock, Paper, Scissors program using Object-Oriented Programming. You will be working with me on a team to build the program. I have already written my part of the program, and the Game.java file is attached. Your task will be to write a RockPaperScissors class that contains the following methods: getUserChoice: Has the user choose Rock, Paper, or Scissors. After validating the input, the method returns a String containing the user choice....

  • This program should be in c++. Rock Paper Scissors: This game is played by children and...

    This program should be in c++. Rock Paper Scissors: This game is played by children and adults and is popular all over the world. Apart from being a game played to pass time, the game is usually played in situations where something has to be chosen. It is similar in that way to other games like flipping the coin, throwing dice or drawing straws. There is no room for cheating or for knowing what the other person is going to...

  • In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play...

    In JAVA Chapter 5Assignment(Rock, Paper, Scissors)–20pointsYour goal is towrite a program that lets the user play the game of Rock, Paper, Scissors against the computer.Your program should have the following: •Make the name of the project RockPaperScissors•Write a method that generates a random number in the range of 1 through 3. The randomly generated number will determine if the computer chooses rock, paper, or scissors. If the number is 1, then the computer has chosen rock. If the number is...

  • (C++) Hey guys we just went over loops and it got me confused, it has me...

    (C++) Hey guys we just went over loops and it got me confused, it has me scrathcing my head for the past two days. I would appreciate any help you guys have to offer. Few places I have a hard time is get input and determine winner(cummulative part). Write a program that lets the user play the Rock, Paper, Scissors game against the computer. The computer first chooses randomly between rock, paper and scissors, but does not display its choice....

  • Use Dev C++ for program and include all of the following. Im lost. Make sure the...

    Use Dev C++ for program and include all of the following. Im lost. Make sure the user enters a letter of R, P, or S and the computer generates a number between 0-2 and changes that number to a letter of R, P or S, using a switch. Make sure the user knows why he/she has won or lost – print a message like “Paper covers Rock” or “Scissors cuts Paper”. Ask the user how many times he/she wants to...

  • Using python 3.7.3 Challenge: Rock, Paper, Scissors GamePDF Description: Create a menu-driven rock, paper, scissors game...

    Using python 3.7.3 Challenge: Rock, Paper, Scissors GamePDF Description: Create a menu-driven rock, paper, scissors game in Python 3 that a user plays against the computer with the ability to save and load a game and its associated play statistics. Purpose: The purpose of this challenge is to assess the developer’s ability to create an interactive application with data persistence in Python 3. Requirements: Create a Rock, Paper, Scissors game in Python named rps.py according to the requirements specified in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT