Question: Step 1 The basic App class should have three fields, title, objective ( of the app ) and costInPence ( in pence of each download

Step 1
The basic App class should have
three fields, title, objective (of the app) and costInPence (in pence of each
download);
a constructor, which allows you to pass arguments to initialise these three attributes in the
order specified above;
accessor and mutator methods for each field.
Step 2: adding functionality to the App class.
For this step, you should
write a method download() which allows a user to "download the exercise app". Since this
is only a model, all we do is output appropriate information. Each piece of information must
be printed on a separate line AND in the order given below AND using the exact text shown
below at the start of each line. The values of each appropriate field then follow that text as in
this example.
Title: Step Counter App
Objective: To get fitter
Download cost: 75
It also updates the value of a new field numberOfDownloads.
add two fields which
o store the name of the player with the highest step count called
highestStepCountName;
o store the step count itself called highestStepCount.
write a method checkStepCount() which, when given a person's step count and name in
that order, checks to see whether that particular step count is the highest step count to date
and if so, replaces the highest step count with this new step count and also replaces the
relevant highest step count name
write a printReport() method which outputs the title, the objective of the app, the cost of
each download, the number of downloads, the highest step count and the name of the person
who has that step count. Each piece of information must be printed on a separate line AND
in the order given below AND using the exact text shown below at the start of each line. The
values of each appropriate field then follow that text as in this example.
Title: Step Counter App
Objective: To get fitter
Download cost: 75
Number of downloads to date: 4539
Highest step count to date: 15000
Player with highest step count: Laura M
Step 3
So far, testing of the program has been quite repetitive and always starts from scratch. However, we
could introduce a default constructor with the field values hard-coded. This means that when we
create our object and then call this default constructor, the field values are automatically inserted
into each field. This will help particularly with your testing. So, introduce a second, default
constructor now.
Then
write a method calculateEarnings() which calculates how much money this particular
app has earnt its writer;
o do not add an extra field to keep track of the running earnings total.
Now amend your printReport() method to include this new information i.e. the earnings
to date, on a separate last line exactly in the manner below.
Title: Step Counter App
Objective: To get fitter
Download cost: 75
Number of downloads to date: 4539
Highest step count to date: 15000
Player with highest step count: Laura M
Earnings to date: 87454
Note that any number printed above should be simply output as a whole number without any
additional symbols or formatting.
Step 4
Introduce a new class, called Controller, to the project. Its purpose is to represent the controller
of the app. It should have
two fields surname and controllerID (where the latter is a mix of numbers and letters);
a suitable constructor with parameters for only these two fields in the order specified above
as well as appropriate accessor methods.
Next add a new field appController, of type Controller, to the App class. Modify Apps
constructor by giving it an additional last parameter so that the new field can be initialised when
the constructor is called.
To test your code
create a Controller object;
create an App object, and pass to its constructor
o values for the three fields (as usual);
o the identifier for the Controller object e.g. controller1(or, more easily, click
on the Controller object on the Object Bench);
inspect the App object using the Object Inspector. If you double click on the
appController field, a new Object Inspector window will open and you should see the
fields of the Controller object you created -- this will confirm that your code for Step 4 is
working correctly.
Now amend the printReport()method of the App class so that it also outputs the surname of the
manager on a separate last line exactly in the manner below
Title: Step Counter App
Objective: To get fitter
Download cost: 75
Number of downloads to date: 4539
Highest step count to date: 15000
Player with highest step count: Laura M
Earnings to date: 87454
Controllers name: Jones

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!