Sign In
Not register? Register Now!
Pages:
2 pages/β‰ˆ550 words
Sources:
Check Instructions
Style:
APA
Subject:
IT & Computer Science
Type:
Coursework
Language:
English (U.S.)
Document:
MS Word
Date:
Total cost:
$ 12.96
Topic:

Assignment in Programming

Coursework Instructions:

Assignment 2 Q1) Write a program that determines the name of a shape from its number of sides. Read the number of sides from the user and then report the appropriate name as part of a meaningful message. Your program should support shapes with anywhere from 3 up to (and including) 10 sides. If a number of sides outside of this range is entered then your program should display an appropriate error message. 10 Points Test cases Enter the number of sides: 1 That number of sides is not supported by this program. Enter the number of sides: 2 That number of sides is not supported by this program. Enter the number of sides: 3 That’s a triangle Enter the number of sides: 4 That’s a quadrilateral Enter the number of sides: 5 That’s a pentagon Enter the number of sides: 6 That’s a hexagon Enter the number of sides: 7 That’s a heptagon Enter the number of sides: 8 That’s a octagon Enter the number of sides: 9 That’s a nonagon Enter the number of sides: 10 That’s a decagon Enter the number of sides: 11 That number of sides is not supported by this program. Q2) Write a program that reads an integer from the user. Then your program should display a message indicating whether the integer is even or odd. 10 Points Hint: Even integer is divisible by 2 Q3) Create a program that reads three integers, a, b and c, from the user.The program should show the results for any values of a,b and c entered by the user.(The goal of this question is to reproduce what we have learned so far, It is a simple exercise that you can try writing code without taking help from a book or material on the internet, you should try and self-check how much of the syntax you remember) Your program should compute and display: 10 Points • The sum of a and b • The difference when b is subtracted from a • The product of a and b • The quotient when a is divided by b • The remainder when a is divided by b • The result of a b • The result if (a+c) less than (b+c) or (a-b) is greater than (b-c) • The result if a b less than b c • Find the greatest of all three integers • Find the smallest of all three integers Hint: You can store the numbers in a list and find the max by sorting the list 2

Coursework Sample Content Preview:

Assignment 2
Name
Institutional Affiliation
Assignment 2
#Question 1
shape = int(input("Enter the number of sides: "))
if shape == 1:
print("That number of sides is not supported by this program.")
elif shape == 2:
print("That number of sides is not supported by this program")
elif shape == 3:
print("That’s a triangle")
elif shape == 4:
print("That’s a quadrilateral")
elif shape == 5:
print("That’s a pentagon")
elif shape == 6:
print("That’s a hexagon")
elif shape == 7:
print("That’s a heptagon")
elif shape == 8:
print("That’s a octagon")
elif shape == 9:
print("That’s a nonagon")
elif shape == 10:
print("That’s a decagon")
elif shape == 11:
print("That number of sides is not supported by this program.")
else:
print("That number of sides is not supported by this program....
Updated on
Get the Whole Paper!
Not exactly what you need?
Do you need a custom essay? Order right now:

πŸ‘€ Other Visitors are Viewing These APA Coursework Samples:

HIRE A WRITER FROM $11.95 / PAGE
ORDER WITH 15% DISCOUNT!