6 caculate

icon picker
debug calculation

debug a program that should calculate results using data entered from the keyboard

program requirement

A triathlon event has three events: run, bike and swim. A competitor’s name, club and scores should be entered. The program should calculate the total score and then display the total. The competitor’s id is simply the club name and the competitor’s name joined by a dot. The program should produce and display the id.

learning point

this task will challenge you to read error messages and find bugs related to entering values of different types and producing results involving arithmetic and String operations.

user interface design

Here is an an example of a dialog where the user is asked to enter values of different types
enter your name: steve
enter your club: spartans
enter your bike points: 34
enter your swim points: 51
enter your run points: 48
spartans.steve your points total is: 133

developer task

The following code has several errors.
Read the code, run the code and use the error messages to debug.
You may have to do this several times until all the bugs are fixed.
This is not a PRIMM task it is a debug task.

program code

Loading…
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.