Questions
For this portion of the lab, you will reuse the Python program you wrote before. That...

For this portion of the lab, you will reuse the Python program you wrote before.
That means you will open the lab you wrote in the previous assignment and change it. You should NOT start from scratch. Also, all the requirements/prohibitions from the previous lab MUST also be included /omitted from this lab.   
Redesign the solution so that some portions of the code are repeated. In lab 4 you validated input to ensure that the user entered inputs within certain values. If the user entered an invalid value, the program terminated. Now you will add a loop such that the user gets three chances to enter a valid value. If the user enters an invalid value more than three times in a row, the program should issue an error message and terminate.

The program I wrote before is shown below.

How can I apply the new requirements to reuse this program?

#Get a value from user.
Miles = float(input('How many miles would you like to convert into kilometers: '))

#Condition
if Miles >= 0:

#Convert miles to kilomters
Kilometers = Miles * 1.6

#Display result
print(Miles,"miles is equal to", Kilometers,"kilometers.")

#Get a value from user.
Gallons = float(input('How many gallons would you like to convert into liters: '))

#Condition
if Gallons >= 0:

#Convert gallons to liters
Liters = Gallons * 3.9

#Display result
print(Gallons,"gallons is equal to", Liters,"liters.")

#Get a value from user.
Pounds = float(input('How many pounds would you like to convert into kilograms: '))

#Condition
if Pounds >= 0:

#Convert pounds to kilograms
Kilograms = Pounds * 0.45

   #Display result

   print(Pounds,"pounds is equal to", Kilograms,"kilograms.")

#Get a value from user.
Inches = float(input('How many inches would you like to convert into centimeters: '))

#Condition
if Inches > 0:
  
#Convert inches to centimeters
Centimeters = Inches * 2.54

#Display result
print(Inches,"inches is equal to",Centimeters,"centimeters.")

#Get a value from user.
Fahrenheit = float(input('How many fahrenheit would you like to convert into celsius: '))

#Condition   
if Fahrenheit < 1000:

#Convert fahrenheits to celsius
Celsius =(Fahrenheit - 32) * 5/9

#Display result
print(Fahrenheit,"fahrenheits is equal to",Celsius,"celsius.")

else:
#Display error message
print('Invalid value!')

else:
#Display error message
print('Invalid value!')

else:
#Display error message

else:
#Display error message
print('Invalid value!')

else:

#Display error message
print('Invalid value!')

In: Computer Science

Price Miles Weight Age 13500 4995 1165 2 13750 5048 1160 2 13950 4874 1165 1...

Price Miles Weight Age
13500 4995 1165 2
13750 5048 1160 2
13950 4874 1165 1
13950 4536 1165 1
13750 5300 1170 2
14800 4125 1165 1
13750 4895 1170 1
13950 4325 1165 2
13700 5000 1165 2
12500 8500 1170 3
11500 9578 1160 3
12400 5675 1165 2
11850 9857 1170 4
10900 10240 1165 4
11450 10253 1170 3
.Please use Excel if you can
A. Estimate a regression model for "Price" = "Miles".
B. Estimate a regression model for "Price" = "Age".
C. If sales is the dependent variable, which of the two independent variables do you think explains sales better? Explain
D. Estimate a Regreesion model for "Price" ="Miles" + "Age" +"Weight", and explain the model fit and the significant variables.

In: Statistics and Probability

Ti Fan and his wife have retired. They are touring the USA in a big recreational vehicle (RV).

 

Ti Fan and his wife have retired. They are touring the USA in a big recreational vehicle (RV). They are towing a Prius car, which they use for running errands when the RV is parked. However, towing the Prius decreases the gas mileage of the RV by 25%. Ti Fan wonders if they would save gas if his wife drives the Prius instead of towing it. The Prius gets good mileage, 50 miles per gallon. Ti Fan has never wanted to know the mileage of the RV, since it would be discouraging. Nonetheless, he looks at the odometer when he fills the RV's gas tank, then looks again when he fills it again. Towing the Prius, he drove 255 miles and burned 37 gallons of gas. How much would they save, in gallons, if they had travelled the 255 miles with his wife driving the Prius while Ti Fan drove the RV?

In: Advanced Math

Volkswagen sells the "Golf" in both gasoline-powered and electric-powered versions. The gasoline Golf gets 37 miles/gallon...

Volkswagen sells the "Golf" in both gasoline-powered and electric-powered versions. The gasoline Golf gets 37 miles/gallon and the electric e-Golf gets 3.42 miles/kWh. Assume the average person drives 12,000 miles per year.

a) What are the annual emissions in kg CO2 for driving the Golf and e-Golf? For gasoline, assume that it emits 8,165 g CO2 per gallon of gasoline. For electricity, use the table below to determine greenhouse gas emissions.

The share of Electricity Mix Emissions factor (g CO2/ kWh)
Natural gas 50 % 400
Coal 30 % 800
Hydro 10% 10
Wind 10% 15

b) If the e-Golf cost $3,000 more than the gasoline Golf, what is the payback time for purchasing the e-Golf instead of the gasoline Golf. Assume the gasoline costs $3/gallon and electricity costs $ 0.10/kWh.

In: Physics

A statisitcs instructor participates in triathalons. the table lists the times in minutes and seconds, he...

A statisitcs instructor participates in triathalons. the table lists the times in minutes and seconds, he recorded while riding five laps through each mile of a 3-mile loop. Use a .05 significance level to test the claim that is takes the same time to ride each of the miles.

Mile 1 3:15 3:25 3:23 3:22 3:22
Mile 2 3:19 3:23 3:20 3:17 3:19
Mile 3 3:34 3:30 3:29 3:30 3:29

Determine the null and alternate hypotheses.

Find the F statistic

P VALUE

What is the conlusion for this hypothesis test?

(fail to reject, reject) There is (sufficient, insufficient) evidence to warrant the rejection of the claime that the three different miles have the same mean ridetime.

Does one of the miles appear to have a hill?

In: Statistics and Probability

Assume that a simple random sample has been selected from a normally distributed population and test...

Assume that a simple random sample has been selected from a normally distributed population and test the given claim. Use either the traditional method or P-value method as indicated. Identify the null and alternative hypotheses, test statistic, critical value(s) or P-value (or range of P-values) as appropriate, and state the final conclusion that addresses the original claim.

A shipping firm suspects that the mean life of a certain brand of tire used by its trucks is less than 33,000 miles. To check the claim, the firm randomly selects and tests 18 of these tires and gets a mean lifetime of 32,250 miles with a standard deviation of 1200 miles. At α = 0.05, test the shipping firm's claim.


a) State the Null and alternative hypotheses   


b) Find the test statistic . (1 mark)  


c) Fine the critical value. ( 1 mark)


d) Draw a final conclusion that addresses the claim ( 2 marks)

In: Statistics and Probability

The distance a vehicle travels can be calculated as follows: Distance = Speed * Time For...

The distance a vehicle travels can be calculated as follows:
Distance = Speed * Time
For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. Both values are assumed to be integers. It should use a
loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph for a three-hour time period, it should display a report similar to the one that follows:

Hours Distance Traveled
---------------------------
1 40
2 80
3 120

Do not accept a negative number for speed and do not accept any value less than 1 for time traveled.

Sample Run
java DistanceTravelled

Enter vehicle speed (in mph): 60↵
Enter time travelled (in hrs): 2↵
Hour→Distance Travelled↵
--------------------------↵
1→→60↵
2→→120↵

In: Computer Science

ASSIGNMENT 5 REQUIREMENTS The distance a vehicle travels can be calculated as follows: distance = speed...

ASSIGNMENT 5 REQUIREMENTS

The distance a vehicle travels can be calculated as follows:

distance = speed * time

For example, if a train travels 40 miles per hour for 3 hours,

the distance traveled is 120 miles.

Write a program that asks the user for the speed of a vehicle

(in miles per hour) and how many hours it has traveled.

The program should then use a loop to display the distance the

vehicle has traveled for each hour of that time period.

Here is an example of the output:

What is the speed of the vehicle in mph? 40

How many hours has it traveled? 3

Hour Distance Traveled

--------------------------------

1. 40

2. 80

3. 120

Input Validation:

Do not accept a negative number for speed and

do not accept any value less than 1 for time traveled.

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

TEST SET

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

TEST CASE SPEED HOURS

1. 55 12

2. 65 10

3. 75 8

----------------------------

In: Computer Science

5. The Gardner Theater, a community playhouse, needs to determine the lowest-cost production budget for an...

5. The Gardner Theater, a community playhouse, needs to determine the lowest-cost production budget for an upcoming show. Specifically, they have to determine which set pieces to construct and which, if any, set pieces to rent from another local theater at a predetermined fee. However, the organization has only two weeks to fully construct the set before the play goes into technical rehearsals. The theater has two part-time carpenters who work up to 12 hours a week, each at $10 an hour. Additionally, the theater has a part-time scenic artist who can work 15 hours per week to paint the set and props as needed at a rate of $15 per hour. The set design requires 20 flats (walls), two hanging drops with painted scenery, and three large wooden tables (props). The number of hours required for each piece for carpentry and painting is shown below:

Carpentry

Painting

Flats

0.5

  2.0

Hanging drops

2.0

12.0

Props

3.0

  4.0

Flats, hanging drops, and props can also be rented at a cost of $75, $500, and $350 each, respectively. How many of each unit should be built by the theater and how many should be rented to minimize total costs?

Gardner Theater
Hours Required/Piece Carpentry Painting
Flats 0.5 2.0
Hanging Drops 2.0 12.0
Props 3.0 4.0
Hours Available 48.0 30.0
Labor Rate/hour $10.00 $15.00

In: Statistics and Probability

Table below shows the multiple logistic regression for factors associated with having three or more cardiovascular...

Table below shows the multiple logistic regression for factors associated with having three or more cardiovascular disease risk factors among a population of 500 participants who participated in a cross-sectional survey.

Table 4. Multiple Logistic Regression for the predictors of having three or more Cardio Vascular Disease risk factors (N=500)

Variables

Odds ratio

95% confidence interval

Perceived health status

Excellent/Very Good

Good

Fair/Poor

2.4

Reference

4.6

0.8-4.2

3.8-7.1

Gender

Female

Male

1.6

Reference

0.9-2.9

Race/Ethnicity

African American

Hispanic

White

2.4

0.6

Reference

0.2-3.9

0.3-1.4

Which variable(s) is considered to be statistically significant? Interpret the odds ratio and the 95% confidence interval for the significant variable(s). [PROVIDE JUSTIFICATION(S) AND RATIONALES]

In: Statistics and Probability