1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OverLord2011 [107]
3 years ago
5

I have been working on this python program for a hour now, and I am trying to figure out what I an doing wrong in the loop. I ha

ve attached the code and screenshot of my work. I need help to figure out how to loop the rest of the years for a calculation. The calculation has looped the same result for all years.
This is the assignment:
In 2017, the tuition for a full time student is $6,450 per semester. The tuition will be going up for the next 7 years at a rate of 3.5% per year. Write your python program using a loop that displays the projected semester tuition for the next 7 years. You should display the actual year (2018, 2019, through 2024) and the tuition amount per semester for that year.
Here is my code:
# declare global constant variables
startingTuition = 6450.00;
starting_tuitionYear = 2018;
ending_tuitionYear = 2025;
increment = 1;
rate = .035;
tuition = 0;
tuitionRate = 0;
#loop for the next 7 years
for year in range(starting_tuitionYear, ending_tuitionYear, increment):
# calculate rate per year
tuitionRate = (rate)*startingTuition;
# add rate per year to the tuition fee
tuition = startingTuition + tuitionRate;
print('Tuition for the year of ' + str(year)+ ' is ' + str(tuition));
Computers and Technology
1 answer:
Alona [7]3 years ago
7 0

Answer:

The correct loop is as follows:

for year in range(starting_tuitionYear, ending_tuitionYear, increment):

   tuition = startingTuition + rate * startingTuition

   startingTuition = tuition

   print('Tuition for the year of ' + str(year)+ ' is ' + str(tuition));

Explanation:

Required

The correction to the attached program

Some variables are not needed; so, I've removed the redundant variables.

The main error in the program is in the loop;

After the tuition for each year has been calculated, the startTuition of the next year must be set to the current tuition

<em>See attachment for complete program</em>

You might be interested in
What should you keep in mind when installing hard drives?
Diano4ka-milaya [45]
Always touch a metal object before installing to prevent short circuiting the hard drive.
5 0
3 years ago
What are some options available in the Spelling and Grammar Checker in word?
denpristay [2]
Some options are add to dictionary, ignore once, ignore all, autocorrect, change, and change all.
6 0
3 years ago
Which is the best response to receiving a threating text from a classmate
Yuri [45]

Answer:

send a threatening text in reply, then block the phone number block the phone number, then contact his phone service provider immediately delete the text, then report the incident to authorities ignore the message, then get a new cell phone number.

Explanation:

5 0
3 years ago
Read 2 more answers
PLZ HELP ME! <br> Write pseudocode for getting a bowl of ice cream using at least four steps.
inessss [21]
1. Get the material that you need
2. Open the ice cream
3. Scoop out the ice cream using your materials
4. Put that scoop in a bowl
4 0
3 years ago
Advatages and disadvantages of power-concentrated train​
allochka39001 [22]

Answer:

1. Safety:

2. Cheap:

3. Increases Employment:

4. Bulk Quantity:

The Disadvantages of Rail Transport are as Follows:

1. Loss of Goods:

2. Unsafe for Fragile Items:

3. Late Bookings:

4. Unsuitable for Short Distances:

5. Unsuitable for Rural Areas:

Explanation:1. Safety:

Transportation by the means of railway ensures safety for the desired goods because unlike the road transports a train only stops at a desired station instead of the will of the driver. In case of road transports for example, the drivers can at any point of time decide to rest or stop for tea, refreshments, lunch or dinner.

2. Cheap:

Railway transport any day is cheaper as compared to air transport. As a matter of fact, railway transport is even cheaper than road transport because of the reason that goods in bulk quantities are carried from a desired destination to the other. In cases of road transport for instance, less goods as compared to road transport can be carried.

3. Increases Employment:

Railway transport helps people to carry cheap products from a place to another and sell them at high prices. As a result of this, a number of people who are unemployed find a source of their daily bread.

4. Bulk Quantity:

ADVERTISEMENTS:

Because railway transportation is cheaper as compared to air and road transport, goods can be carried in bulk quantities as a result of which a lot of time is saved.

It is true that as compared to air transport and road transport, rail transport is easier and cheaper but still it has a few disadvantages.

The Disadvantages of Rail Transport are as Follows:

1. Loss of Goods:

Because goods in bulk quantities are carried chances of goods getting lost are high in case of railway transport as compared to air and road transport.

2. Unsafe for Fragile Items:

Railway transportation is particularly unsafe for carrying fragile items like glass because these items can easily break at times when a train halts unexpectedly of when the train is speeding up at times.

3. Late Bookings:

ADVERTISEMENTS:

Because railway is the cheapest medium of transport, it is hard to find suitable bookings for the transportation of your goods. Railway transport is not suitable in cases of emergency.

4. Unsuitable for Short Distances:

Railway transport is unsuitable for carrying goods at shorter distances; road transport is most suitable in this case.

5. Unsuitable for Rural Areas:

Proper railway system is not build up in the Indian villages as a result of which railway transport is unsuitable in the villages of India. Whatever be the disadvantages of railway transport it was, it is and it will always be the safest and the best means for the transportation of goods.

5 0
3 years ago
Other questions:
  • If you receive an increase in pay, how will that affect your payroll deductions?
    8·1 answer
  • All the processing-of work-done on a computer is performed by the what?
    11·1 answer
  • In the year of our Lord 66, the Emperor Nero, being at that time in the twenty-ninth year of his life and the thirteenth of his
    10·1 answer
  • The ________ is an area where you can position fields to use for filtering the PivotTable and thereby enabling you to display a
    11·1 answer
  • Which is true about TCP and UDP? Choose two answers.
    15·1 answer
  • Enables businesses and consumers to share data or use software applications directly from a remote server over the Internet or w
    6·1 answer
  • How do you change the top and bottom margins of an entire document?
    7·2 answers
  • How are online sources used? Check all that apply.
    8·2 answers
  • Overnight Delivery Service delivers a package to Pam. At the request of Overnight's delivery person, to acknowledge receipt Pam
    13·1 answer
  • A multinational organization that offers web-based services has datacenters that are located only in the United State; however,
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!