Question

In: Computer Science

In each of the projects that follow, you should write a program that contains an introductory...

In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs.

5 An object’s momentum is its mass multiplied by its velocity. Write a pro- gram that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.

6 The kinetic energy of a moving object is given by the formula KE=(1/2)mv2, where m is the object’s mass and v is its velocity. Modify the program you created in Project 5 so that it prints the object’s kinetic energy as well as its momentum.

Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations:

- A kilometer represents 1/10,000 of the distance between the North Pole and the equator.

- There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator.

- A nautical mile is 1 minute of an arc.

*please use IDLE( python 3.7)

Solutions

Expert Solution

5 An object’s momentum is its mass multiplied by its velocity. Write a pro- gram that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.

python 3.7 Code

============================================================================================

mass=float(input('Enter object''s mass in kilograms: '))
velocity=float(input('Enter object''s velocity in meter per second: '))

momentum = mass*velocity

print('Momentum is : ',momentum,'kg·m/s',)

============================================================================================

Output

============================================================================================

6 The kinetic energy of a moving object is given by the formula KE=(1/2)mv2, where m is the object’s mass and v is its velocity. Modify the program you created in Project 5 so that it prints the object’s kinetic energy as well as its momentum.

mass=float(input('Enter object''s mass in kilograms: '))
velocity=float(input('Enter object''s velocity in meter per second: '))

momentum = mass*velocity
KE = (1/2)*mass*velocity*velocity

print('Momentum is : ',momentum,'kg·m/s',)
print('Kinetic Energy is : ',KE)

============================================================================================

Output


Related Solutions

In each of the projects that follow, you should write a program that contains an introductory...
In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs. Q. Write a program that takes as...
AskInfoPrintInfo Write a program called AskInfoPrintInfo. It should contain a class called AskInfoPrintInfo that contains the...
AskInfoPrintInfo Write a program called AskInfoPrintInfo. It should contain a class called AskInfoPrintInfo that contains the method main. The program should ask for information from the user and then print it. Look at the examples below and write your program so it produces the same input/output. Examples (the input from the user is in bold face) % java AskInfoPrintInfo enter your name: jon doe enter your address (first line): 23 infinite loop lane enter your address (second line): los angeles,...
UseMath Write a program called UseMath. It should contain a class called UseMath that contains the...
UseMath Write a program called UseMath. It should contain a class called UseMath that contains the method main. The program should ask for a number from the user and then print the information shown in the examples below. Look at the examples below and write your program so it produces the same input/output. Examples (the input from the user is in bold face) % java UseMath enter a number: 0 the square root of 0.0 is: 0.0 rounded to the...
Python 3.7.4 (Introductory Level) You want to know your grade in Computer Science: Write a program...
Python 3.7.4 (Introductory Level) You want to know your grade in Computer Science: Write a program that continuously takes grades between 0 and 100 to standard input until you input "stop", at which point it should print your average to standard output.
Write a lex program that can identify each of the following tokens. The program should produce...
Write a lex program that can identify each of the following tokens. The program should produce a line for each token where the first word is token itself followed by the token type. • Identifiers: name of variables and functions (identifier name should be started by a letter followed by letters or digits and maximum eight characters in length). • Keywords: if, then, else, for, while, do, switch, case etc. • Numbers: integer, float (float number format that supports in...
You should write a small C++ program that performs the following tasks: First, your program should...
You should write a small C++ program that performs the following tasks: First, your program should read in a set of 5 integers from “standard in” (remember cin). The numbers that you read in will be either zero or positive. If at least one of the five numbers entered is non-zero then your program should calculate the sum of the numbers and report that back to the user using “standard output” (remember cout). Then your program should be ready to...
In this problem, you will write a program that reverses a linked list. Your program should...
In this problem, you will write a program that reverses a linked list. Your program should take as input a space-separated list of integers representing the original list, and output a space-separated list of integers representing the reversed list. Your algorithm must have a worst-case run- time in O(n) and a worst-case space complexity of O(1) beyond the input. For example, if our input is: 5 7 1 2 3 then we should print: 3 2 1 7 5 Please...
Write a program in C++ (parking.cc) that reads a group of input lines. Each line contains...
Write a program in C++ (parking.cc) that reads a group of input lines. Each line contains an A for arrival or a D for departure, which is terminated by a :, and a license plate number, which is terminated by a :. The program should print a message each time a car arrives or departs. When a car arrives, the message should specify when the garage is full. If there is no room for a car, the car simply leaves....
XML and JAVA Write a Java program that meets these requirements. It is important you follow...
XML and JAVA Write a Java program that meets these requirements. It is important you follow these requirements closely. • Create a NetBeans project named LastnameAssign1. Change Lastname to your last name. For example, my project would be named NicholsonAssign1. • In the Java file, print a welcome message that includes your full name. • The program should prompt for an XML filename to write to o The filename entered must end with .xml and have at least one letter...
what are the 10 steps you think student should follow to write a paper at doctoral...
what are the 10 steps you think student should follow to write a paper at doctoral level
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT