Back
• Assignment Services
• Engineering
• Mechanical
• Basic Subjects
• Law
• Management
• Accounting and Finance
• Programming
• Medical
• Humanities
• Essay
Back
• Writing Services help
Back
• Dissertation help
Back
• Assignment by Universities
Back
• Homework help
Back
• Australia
• New Zealand
• United Kingdom
• United States of America
• Malaysia
• United Arab Emirates
• Singapore
• China
• Ireland
Back
• CDR Report

Welcome to Live Chat

Welcome to LiveWebTutors Services, World's leading Academic solutions provider with Millions of Happy Students.

Call Back

24x7 Support Available

chat now

In A Hurry? Get A Callback

### shopping cart 0

Subject Solutions Code Description Price Delete

## PROGRAMMING AND DATA STRUCTURES

#### Question Preview:

Question B1 A fitness application has been written to allow people to log exercise activities which they take, and identify their best speeds over time. Some code has already been written for this application, shown below. public class Activity { private double duration; // in seconds private double distance; // in kilometres private String comment; // describe activity public Activity(double t, double d, String w) { duration = t; distance = d; comment = w; } /** * get average speed for activity, in km/h */ public double averageSpeed() { // to be completed } The class Ac...

View Complete Question >>

#### Question Preview:

Question B1 A fitness application has been written to allow people to log exercise activities which they take, and identify their best speeds over time. Some code has already been written for this application, shown below. public class Activity { private double duration; // in seconds private double distance; // in kilometres private String comment; // describe activity public Activity(double t, double d, String w) { duration = t; distance = d; comment = w; } /** * get average speed for activity, in km/h */ public double averageSpeed() { // to be completed } The class Activity records details of an individual fitness event. The averageSpeed() method is incomplete. a) Complete the body of the averageSpeed() method, to calculate the average speed in kilometres per hour. Note that seconds can be converted to hours by dividing by 3600. [4 marks] [CSC8001] Page 3 of 5 A separate class, Log, will maintain a list of Activity objects together with the name of the person doing the activities. The class has been partially written, as follows: import java.util.ArrayList; public class Log { private String name; private ArrayList activities; // constructor method to be completed public Activity bestSpeed() { Activity topAct; // find activity with highest speed return topAct; } } b) Write a constructor method for the Log class. New Log objects should have a name initialised using a parameter to the constructor method, and an empty list of activities. [6 marks] c) Write a method, addActivity, to class Log, to add a new activity to the activities ArrayList. [4 marks] [CSC8001] Page 4 of 5 d) The bestSpeed()method will search all recorded activities and return the activity with the highest average speed. This method has been partially written in the class declaration shown on the previous page. Complete the body of the bestSpeed() method. [6 marks] e) The activities list has the following type declaration: private ArrayList activities; Use of an ArrayList to store the Log entries may be a problem if a large number of activities are to be recorded, for example over the course of several years. Users of the system have said they would like to be able to find an activity using the date when the activity took place. Suggest an alternative collection type that could be used to store log entries, and access them by date (represented as a String). Provide a type declaration for your chosen collection type. [5 marks] Question B2 The personnel management program at the University of Outer Hebrides must handle information about the people employed there. Employees may be on permanent or fixed-term contracts. Write declarations for the following: a) A class Employee, containing six fields specifying the name, personnel number, address, designation (e.g., “lecturer”, “technician”, etc.), department and salary of the person concerned (choose appropriate names and types). Values for those state variables should be passed as parameters to the class’s constructor. This class should include appropriate accessor and mutator methods. [6 marks] [CSC8001] Page 5 of 5 b) Classes Permanent and FixedTerm, which extend the Employee class. Class Permanent adds a starting date of an employee’s permanent contact (passed as a parameter to the constructor). Class FixedTerm adds the duration of a fixed term employee’s contract (passed as a parameter to the constructor). [7 marks] c) A method called z, which prints out the names of all employees on permanent contracts in the department of Zoology, and also prints out the total salary bill of that department. The method should take as a parameter an ArrayList, which contains Employee objects representing all employees in the University. [12 marks] END

View Less >>

## Solution Preview

Solution in attached zip file

Get solution

#### \$40

Orginal Price : \$52.0

Pay Now

250 words

Don’t delay more, place your order now. Quick assignment help will be offered to you.

Order Now

## CUSTOMER REVIEWS

### Excellent

Based on 702 reviews See all reviews here

### One of the Best Service

I trust LiveWebTutors for my assignments because of their ability to deliver the perfect assignments time and again. Only a few of my assignments required minor revisions. The rest assured it is the best assignment writing service in the market.

Elizabeth
Sydney

### Great Service and on time

I felt so exhausted and burdened with the large number of assignments I had to write and desperately needed someone to help me with all the writing and there was LiveWebTutors company on the internet. They finished my assignments before the due date and also offered me a first-timer discount.

Christina
Perth

### One of the Best Assignment Provider

I ordered my Mathematics and Marketing assignments from them last month. I received the content on the set date. Most importantly, the assignments were well-written and plagiarism free. I scored a top grade for the assignment written by them. They are a reliable company.

Oli
Brisbane