Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Design and implement classes to perform the required functionalities. These classes are separated from the GUI. Design and implement user - Exercise Trackerfriendly GUI. Design

Design and implement classes to perform the required functionalities. These classes are separated from the GUI.
Design and implement user- Exercise Trackerfriendly GUI.
Design and implement classes to handle persistent data sources (i.e., files)
In this assignment, we will use many of the concepts we had learned about to design a simple exercise tracker. The exercise tracker will be able to track three different kinds of exercises: run/walk, weightlifting, and rock climbing. It will store the data the user enters about each workout and will be able to save it to a file. It will also be able to present it on screen sorted by either data or calories burned.
All kinds of exercises can be described in terms of a name, a comment, the date it took place, and its duration. In addition, run/walk exercises have a distance, weightlifting has an amount lifted, and rock climbing has the height of the wall and number of repetitions. This gives rise to the following hierarchy of classes:
Superclass: Exercise, containing the things that are common to all exercises
Subclasses: RunWalk, WeightLifting, and RockClimbing
Each type of exercise has its rate for burning calories. For this simplified exercise tracker, we will assume the following:
RunWalk: distance in miles divided by duration in minutes, then multiplied by 9000
Weightlifting: total weight lifted in pounds divided by duration in minutes, then multiplied by 50
Rock climbing: height of wall times number of times scaled divided by duration in minutes, then multiplied by 100.
You must declare the Exercise class to be abstract. It will have variables for storing the things that are common to all exercises. It will have get and set functions and constructors. It will use the java.util.Date class to store the date, but it will provide a way to set the data from a String having MM/DD/YYYY format for convenience. (This will require using the SimpleDateFormat class with format MM/dd/yyyy.) It will have a toString() function that will help with writing a tab-delimited description of the exercise to a file. It will have an abstract getType() function that, in subclasses, will return the type of the exercise. It will have an abstract getCaloriesBurned() function that, in subclasses, will return the calories burned. It will also implement the Comparable interface so that a list of exercises can be sorted by their date.
You must declare the RunWalk, WeightLifting, and RockClimbing subsclasses of Exercise. Each of these will introduce variables for storing the things that are specific to these exercises. They will implement the abstract functions that were introduced in Exercise.
You must declare a class called ExerciseCompareByCalories that implements Comparator. It will override the inherited compare() function to compare two Exercise objects by their calorie values. This will make it possible for us to sort the list of exercises by their calories burned.
You must declare a class called ExerciseWriter. It will have static functions for writing a list of exercises in tab-delimited format to the screen or to a file as well as a function called tabulateSummary that will print a table of exercises containing columns for the type, name, date and calories burned for each exercise.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago