Write a gradebook program that lets a teacher keep track

Assignment Help Python Programming
Reference no: EM132357036

Question

For this assignment you will be writing a series of short programs.

Part 1: 99 Bottles of Beer on the Wall

Your assignment is to write a program that sings (i.e. prints) the road trip song, "99 Bottles of Beer".

To quote Wikipedia"s entry about this song,

"99 Bottles of Beer" is a traditional song in the United States and Canada. It is popular to sing on long trips, as it has a very repetitive format which is easy to memorize, and can take a long time to sing. In particular the song is frequently sung by children on long bus trips, such as class field trips, or on Scout and/or Girl Guide outings.

Depending on how long the road trip is, students (i.e. users), must decide how many bottles of beer to start with. So the program should ask for that input. The program should then proceed to output lyrics from the song until there are no more bottles of beer on the wall.

Example input/output

Sample input:

How many bottles of beer on the wall? -5
Sorry, that's not a valid number of bottles. Try again.

How many bottles of beer on the wall? 5

OK, here we go!

Sample output:

5 bottles of beer on the wall, 5 bottles of beer.
Take one down, pass it around, 4 bottles of beer on the wall.

4 bottles of beer on the wall, 4 bottles of beer.
Take one down, pass it around, 3 bottles of beer on the wall.

3 bottles of beer on the wall, 3 bottles of beer.
Take one down, pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down, pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.

Take it down, pass it around, no more bottles of beer on the wall!

Some notes on your program:

"One bottle" is singular, while "Two bottles" is plural. This grammar should be correctly output by your program.

The last verse says, "no more bottles of beer on the wall!" instead of "0 bottles of beer on the wall."

If a user enters an invalid response to the question, "How many bottles of beer on the wall?", the program must ask the question again and again until a proper number is given in response.

Part 2: Dynamic Gradebook

Write a gradebook program that lets a teacher keep track of test averages for his or her students. Your program shoudl begin by asking the teacher for a number of students in their class as well as the total # of tests that will be given to the class. Validate this information to ensure that the numbers entered are positive.

Next, prompt the teacher to enter in scores for each student. Ensure that the values entered are positive - if they aren't you will need to re-prompt them. Hint: you may need to use nested loops here! A "while" loop can be placed inside of a "for" loop, if necessary.

Once your program has collected all test scores for a student it should display that student's average and move onto the next student. When all students have been calculated the program should compute the overall average score for the entire class.

Here's a sample running of your program:

How many students are in your class? -5
Invalid # of students, try again.

How many students are in your class? 3
How many tests in this class? -10
Invalid # of tests, try again.
How many tests in this class? 2

Here we go!

**** Student #1****
Enter score for test #1: -50
Invalid score, try again
Enter score for test #1: 50
Enter score for test #2: 75
Average score for student #1 is 62.50

**** Student #2****
Enter score for test #1: 100
Enter score for test #2: 90
Average score for student #1 is 95.00

**** Student #3****
Enter score for test #1: -10
Invalid score, try again
Enter score for test #1: -20
Invalid score, try again
Enter score for test #1: -30
Invalid score, try again
Enter score for test #1: 90
Enter score for test #2: 80
Average score for student #1 is 85.00

Average score for all students is: 80.83

Part 3a: Prime Number Finder

Write a program that prompts the user to enter in a postiive number. Only accept positive numbers - if the user supplies a negative number or zero you should re-prompt them.

Next, determine if the given number is a prime number. A prime number is a number that has no positive divisors other than 1 and itself. For example, 5 is prime because the only numbers that evenly divide into 5 are 1 and 5. 6, however, is not prime because 1, 2, 3 and 6 are all divisors of 6.

Here's a sample running of the program:

Enter a positive number to test: 5

2 is NOT a divisor of 5 ... continuing
3 is NOT a divisor of 5 ... continuing
4 is NOT a divisor of 5 ... continuing

5 is a prime number!
And here's another running:

Enter a positive number to test: 9

2 is NOT a divisor of 9 ... continuing
3 is a divisor of 9 ... stopping

9 is not a prime number.
Some notes on your program:

1 is technically not a prime number.

Once you find a number that evenly divides into your test number you do not need to continue testing additional numbers - the number cannot be prime.

Part 3b: Find all Prime Numbers between 1 and 1000

Next, make a copy of Part A and update it so that the program now finds all prime numbers between 1 and 1000. Here's a sample running of your program:

1 is a prime number!
2 is a prime number!
3 is a prime number!
5 is a prime number!
7 is a prime number!
11 is a prime number!

... cut ...

977 is a prime number!
983 is a prime number!
991 is a prime number!
997 is a prime number!

Part 3c: Custom Number Range

Make a copy of Part B and update it so that the user can choose to examin a specific range of numbers for prime numbers. Here's a sample running of your program:

Start number: 5
End number: -5
Start and end must be positive

Start number: 5
End number: 3
End number must be greater than start number

Start number: 5
End number: 23

5
7
11
13
17
19
23

Some notes on your program:

You need to ensure that the start and end numbers are both postive.

You also need to ensure that the start number is less than the end number.

Extra credit: Print the prime numbers that you find within the given range so that only 10 numbers print per line. Align the numbers so that they stack neatly on top of one another in all cases. Here's a sample running of the program:

Start number: 1

End number: 100

1 2 3 5 7 11 13 17 19 23

29 31 37 41 43 47 53 59 61 67

71 73 79 83 89 97

And here's another running:

Start number: 1

End number: 1000

1 2 3 5 7 11 13 17 19 23
29 31 37 41 43 47 53 59 61 67
71 73 79 83 89 97 101 103 107 109
113 127 131 137 139 149 151 157 163 167
173 179 181 191 193 197 199 211 223 227
229 233 239 241 251 257 263 269 271 277
281 283 293 307 311 313 317 331 337 347
349 353 359 367 373 379 383 389 397 401
409 419 421 431 433 439 443 449 457 461
463 467 479 487 491 499 503 509 521 523
541 547 557 563 569 571 577 587 593 599
601 607 613 617 619 631 641 643 647 653
659 661 673 677 683 691 701 709 719 727
733 739 743 751 757 761 769 773 787 797
809 811 821 823 827 829 839 853 857 859
863 877 881 883 887 907 911 919 929 937
941 947 953 967 971 977 983 991 997

Reference no: EM132357036

Questions Cloud

Recommending products and services to customers : Could you please give me some steps on Procedures for recommending products and services to customers?
Find solutions for the global threats discussed so far : Technology, technological advancements and changes may affect how we can work to find solutions for the global threats discussed so far.
Bring out cutouts for children to decorate : And you know that the children also love art. One day, you decide to bring out cutouts for children to decorate.
Corporate social responsibility on the decision : Lastly, how would you evaluate the impact of corporate social responsibility on the decision?
Write a gradebook program that lets a teacher keep track : Write a gradebook program that lets a teacher keep track of test averages for his or her students. Your program shoudl begin by asking the teacher.
Foundational strategy development models : HI6006 - Competitive Strategy - Essay — Key Strategy Development Tools - what the main strategy development tools are and how they are used in business.
Implications of International Accounting in Australia : HI6025 Accounting Theory and Current Issues Assignment, Holmes Institute, Australia. Implications of International Accounting in Australia
Discuss the various characteristics of right-wing terrorism : Discuss the various characteristics of right-wing and left-wing terrorism within the United States. What are the similarities and differences between the two?
Uber hits a bump in the road : 1. What are the ethical challenges that Uber faces in using app-based peer-to-peer sharing technology?

Reviews

Write a Review

Python Programming Questions & Answers

  Construct a python function named finder that takes two

Construct a Python function named finder that takes two string parameters, needle and haystack. Your function should find the first.

  Look up terms in a tech dictionary

Create a program that allows a user to look up terms in a tech dictionary - programming or scripting that is of interest to you, and complete one or more web-based tutorials on the topic.

  Discuss problem related to exception handling

You decide to upload your recent project to a programming community website for feedback, and one thing that community users keep pointing to is the lack.

  Write program to gather-display results of golf tournament

Write a program to gather, then display the results of the golf tournament played at the end of March. The Club president Mr. Martin has asked you

  Write a python program that executes the steps

Given the previous Introduction, write a Python program that executes the following steps: 1. Asks the user to enter a string (Obj) containing all the object names (see example below); 2. Asks the user to enter a string describing the initial state, ..

  Define a function that takes an argument

Define a function that takes an argument. Call the function. Identify what code is the argument and what code is the parameter.

  1 one factor that leads to a decline in biodiversity is the

1. one factor that leads to a decline in biodiversity is the introduction of non-native species. however most species

  Write a while loop that keeps printing the menu selection

An inventory of the media store is displayed when option 1 is selected. We can see the references, media type, title and price of each item.

  Write a class named employee

Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title

  Write pseudo code - biorythm 1

Two programs biorythm 1 and BIORYTHM 2 with cos and sin, you only need to write throry section which is written in the word file table

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Write a program using python that asks the user to enter

Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50%

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd