Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2) Indicate after each if the println or assignment statement is VALID or INVALID. A statement is VALID if it has no compilation/syntax error. Otherwise,

2)Indicate after each if the println or assignment statement is VALID or INVALID. A statement is VALID if it has no compilation/syntax error. Otherwise, it is INVALID. If it is INVALID, list what the error is.

  1. print ("Here is some output.")

  1. print ("And some more ...)

  1. print ("Add this string + to this one.")

  1. print ("The capital of Alaska", "is Juneau.")

3) Write a Python program that displays lyrics from the song Somewhere Over the Rainbow from The Wizard of Oz. Here are the lyrics:

Somewhere over the rainbow way up high,

There's a land that I heard of once in a lullaby.

Somewhere over the rainbow skies are blue,

And the dreams that you dare to dream really do come true.

Somewhere over the rainbow bluebirds fly.

Birds fly over the rainbow. Why then, oh why can't I?

You may start with the Python Template available on Blackboard. Complete the header comment by replacing with the application title, with the homework number, with your name, etc. Have good programming style by using comments, indentation, and blank lines in your code to make it readable. For blank lines between paragraphs in your output, you may use Python statement:

print ()

4) Write a Python program to determine the pays and taxes on a paycheck based on an hourly rate (data type float) and the number of hours worked (data type int). Calculate the gross pay, federal tax, FICA (Social Security and Medicare) tax, state tax, and net pay based on the hourly rate and time worked. Here are the formulas:

gross pay = hourly rate * time worked

federal tax = gross pay * 0.15

FICA tax = gross pay * 0.0765

state tax = gross pay * 0.0435

net pay = gross pay federal tax FICA tax state tax

You may start with the Python Template, or sample code available on Blackboard. The program prompts the user for an hourly rate and a number of hours worked. It then performs the calculations. Finally, it shows the two inputs and the five outputs (calculations) on the screen. Include the units ($/hour, hours, $) for each input/output value, and show one input/output per line. Format each number in the output to two decimal places. This may be accomplished with the Python formatted print statement. Here is an example:

print ("Gross pay: ${0:10.2f}".format(grossPay))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions