Home Page > > Details

Help With ITP122 Assignment 3 Task FINALGhostwriter Python Programming

Task 1: [35%]

Write a program to calculate how far a tennis ball will touch the ground. For example, if the ball travels 20 meters per minute for seven minutes, the distance travelled is 20*7=140 metres.

Write a program that asks the user for the speed of a ball (in meters per minute) and the number of minutes it has travelled. You should then use a while loop to display the distance travelled for each minute. (The distance ball travels can be calculated as follows: distance = speed * time).

Sample output:

What is the speed of the ball in (in metres per minute)? 20

How many minutes has it travelled? 7

Hour     Distance Travelled

1           20

2           40

3           60

4           80

5         100

6         120

7         140

The above task should make an appropriate use of try-catch and ensures correct inputs are processed, and incorrect inputs are handled by using exceptions.

Task 2: [65%]

The Champions Soccer Club has a tournament every weekend. The club president has asked you to write a program to store the player and score details.

A  program  needs  to  manipulate  each  player’s  name  and  soccer  score  as  entered from the  input console. Make an appropriate use of dictionary data structure in python to handle this task. You can use key : value pair as PlayerName : Score.

The main program should first display a menu as follows. A user needs to select an operation from the main menu.

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

**Welcome to Champions Soccer Club**

Please choose an option from the followings.

1) Add playername and score

2) Display all the player information and scores

3) Quit.

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

When option-1 is selected, the program allows the user to enter the player’s name and score then store this information into the dictionary and provides the option to repeat this operation to add another player again. i.e., If user choose 'Y' or 'Yes'then repeat the Add operation. If the user chooses 'N' or 'No' then comeback to main menu.

The following input validations must be performed on the data before saving the information into dictionary. Playername should be alphabetic letter (should not contain any digits). Player score should be digits and it should contain the values only from 0- 100. If the input validations are incorrect, then display the appropriate message to user and allow to repeat the entry.

When option-2 is selected, the program reads the displays the contents of dictionary with player name and score on the screen.

When option-3 is selected, the program quits/terminates.

Sample output screen:

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

**Welcome to Champions Soccer Club **

Please choose an option from the followings.

1) Add playername and score

2) Display all the player information and scores

3) Quit.

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

Enter your choice            : 1

Enter the playername   : Messy

Enter the score                 : 80

Do you want to add another player? Y

Enter the playername   : Ronaldo

Enter the score                 : 150

**Incorrect score** The scores should be from 0-100. Please try again!

Enter the score                 : 100

Do you want to add another player? N

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

**Welcome to Champions Soccer Club **

Please choose an option from the followings.

1) Add playername and score

2) Display all the player information and scores

3) Quit.

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

Enter your choice            - 2

Player & Score Details:

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

Player            Score

Messy             80

Ronaldo          100

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

**Welcome to Champions Soccer Club**

Please choose an option from the followings.

1) Add playername and score

2) Display all the player information and scores

3) Quit.

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

Enter your choice            - 3

**GoodBye.. See you again!**






Contact Us - Email:99515681@qq.com    WeChat:codinghelp
Programming Assignment Help!