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
Security controls are measures taken to protect systems from attacks on the integrity, confidentiality, and availability of the
Delvig [45]

Answer:

The correct option is D: Administrative controls

Explanation:

Administrative controls are also known as work practice controls and involves changes in the procedure of work such as rules, schedules, policies, training etc, with the intention of cutting down to the barest minimum incidence, duration, and the graveness of exposure to situations or chemical that constitute a hazard. Drug screening test would be to ensure that the employee is fit to work and does not form a hazard and thus is an administrative control.

4 0
3 years ago
What is the purpose of the operating system's processor management function?
Sloan [31]
The purpose of the operating system's processor management function is that it allows you to run multiple programs on your computer simultaneously. 
5 0
3 years ago
What can be defined as in information technology environment?
natka813 [3]
Here is your answer

7 0
3 years ago
Read 2 more answers
A computer has __________processing device
Artist 52 [7]

Answer:

electronic processing device

4 0
3 years ago
What is not an operating system
Lostsunrise [7]
The answer is MS-Word
5 0
3 years ago
Other questions:
  • What is the operating system?
    9·1 answer
  • Your health insurance company gives you a discount if you wear a fitness-tracking bracelet. After wearing it for a few months, y
    5·1 answer
  • Write a while statement that prints all even numbers between 1 and 100 to the screen.
    6·1 answer
  • Which of these BEST describes an inference?
    11·2 answers
  • PLEASE HELPPPPPPP
    15·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • PLEASE HELP ME ANSWER AS MUCH AS YOU CAN I ONLY HAVE 3 POINTS LEFT AND IM TIMED. PLEASE TELL ME THE NUMBER AND LETTER. THANK YOU
    5·1 answer
  • How do you know if something is in the public domain
    5·1 answer
  • What feature is available to add a suggestion in the margin of someone else's document?​
    15·1 answer
  • What is the best food to eat before workout? why?​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!