logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Jaida PatrickTechnical writing
(5/5)

949 Answers

Hire Me
expert
Cecil BoazFinance
(5/5)

962 Answers

Hire Me
expert
Bhargav AppasaniiEngineering
(/5)

710 Answers

Hire Me
expert
Taimoor IftikharComputer science
(/5)

726 Answers

Hire Me
Python Programming

Write a program that accepts three integers from the user, and that prints either “Yes” or “No,” depending on whether you can or cannot form a triangle from sticks with the given lengths.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Programming in Python 3.8

Conditions Assignment

If you are given three sticks, you may or may not be able to arrange them in a triangle. For example, if one of the sticks is 12 inches long and the other two are 1 inch long, it is clear that you will not be able to get the short sticks to meet in the middle. For any three lengths, there is a simple test to see if it is possible to form a triangle:

If any of the three lengths is greater than the sum of the other two, then you cannot form a triangle. Otherwise, you can. (If the sum of two lengths equals the third, they form what is called a “degenerate” triangle.)

Write a program that accepts three integers from the user, and that prints either “Yes” or “No,” depending on whether you can or cannot form a triangle from sticks with the given lengths.

Here is some sample input/output that you can use for testing.

Example 1
This program will determine if three lengths can form a triangle.
Enter length 1:
> 5
Enter length 2:
> 2
Enter length 3:
> 45
No.

Example 2
This program will determine if three lengths can form a triangle.
Enter length 1:
> 5
Enter length 2:
> 3
Enter length 3:
> 3
Yes.

For Loop Assignment

In this assignment, we will do something a little different. You will create a program that outputs the multiplication table from 1 to 9 using what you've learned about "for" loops. Your program must do the multiplication for each number in the table. The output of your program should look like the figure below. Hint: Create a program using multiple for loops; you will also need a conditional statement and use a mathematical operator.

Functions Assignment

For this assignment, you need to create a function that implements the Triangle Classification Algorithm. The algorithm has a lot of steps in it, but each step is simple. We have covered enough material to implement this. 

The Triangle Classification Algorithm accepts three integer lengths and it returns a 1, 2, 3, or 4. The three lengths represent possible lengths to the sides of a triangle. Returning a 1 means that the lengths would form a scalene triangle. Returning a 2 means that the sides would form an isosceles triangle. Returning a 3 means that the sides would form an equilateral triangle. Returning a 4 means that the sides cannot form a triangle. For example, sides 1, 1, and 10 cannot form a triangle.

Below you will find a control flow graph of the algorithm. The brackets in the graph [ and ] are just there as a means of referencing each condition. Also, the || symbol is or. The top oval says, "Read i, j, k". These variables should be passed in as parameters to your function. The second oval is equivalent to

if i <= 0 or j <= 0 or k <= 0

Everything else on the chart should be easy to understand, but ask questions if needed.

Write a function for the implementation of the Triangle Classification Algorithm.  Also, write a program that uses the function. This program should ask the user to enter the three lengths, and it returns the result of calling the function. 

Triangle Classification Algorithm

Package and Libraries Assignment

For this assignment, you need to create a program that allows the user to do basic trigonometry functions. First, ask the user if he or she would like to do sine, cosine, or tangent (sin, cos, tan). Then, ask the user for a decimal number and return the results.

Here is some sample output:

Welcome to the simple trigonometry helper.
Would you like to do:
1. sin
2. cos
3. tan
> 1
Enter the number to sin:
> 1.1
0.0191974

To complete this assignment, you will need to do some research. First, check to see if these trigonometry functions are part of your language. Next, see if they are included with the language, but need to be imported. Finally, look externally for them. 

Final Project

Your program is going to compare the scores of two volleyball teams that play each other. To win a match in volleyball, a team must get 25 points. But the team must also win by 2. So even if a team reaches 25, that game continues until one team is ahead by 2 points. Let’s assume that these two teams are going to play five matches.

Your program should accept from the user the scores for each team one match at a time. If at any time that user enters scores that violate the 25-point rule or the “win by 2” point rule, print an error on the screen and make the user enter both scores again.

When the user is finished entering the scores, the program should print which team won the game. This is the team that won the most matches.

You have to use arrays and loops in this assignment.

In the sample output examples, what the user entered is shown in italics.

Sample Output 1

Welcome to the volleyball score program.
Enter the number of points Team 1 got in Match 1
10
Enter the number of points Team 2 got in Match 1
25
Enter the number of points Team 1 got in Match 2
1
Enter the number of points Team 2 got in Match 2
25
Enter the number of points Team 1 got in Match 3
23
Enter the number of points Team 2 got in Match 3
25
Enter the number of points Team 1 got in Match 4
10
Enter the number of points Team 2 got in Match 4
25
Enter the number of points Team 1 got in Match 5
0
Enter the number of points Team 2 got in Match 5
25
Team 2 has won the game.

Sample Output 2

Welcome to the volleyball score program.
Enter the number of points Team 1 got in Match 1
10
Enter the number of points Team 2 got in Match 1
24
That can’t be. One team must get at least 25 points. Please reenter the data.
Enter the number of points Team 1 got in Match 1
10
Enter the number of points Team 2 got in Match 1
25
Enter the number of points Team 1 got in Match 2
1
Enter the number of points Team 2 got in Match 2
25
Enter the number of points Team 1 got in Match 3
23
Enter the number of points Team 2 got in Match 3
25
Enter the number of points Team 1 got in Match 4
10
Enter the number of points Team 2 got in Match 4
25
Enter the number of points Team 1 got in Match 5
24
Enter the number of points Team 2 got in Match 5
25
That can’t be. One team must win by 2 points. Please reenter the data.
Enter the number of points Team 1 got in Match 5
24
Enter the number of points Team 2 got in Match 5
26
Team 2 has won the game.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme