CSE8A_HW9

CSE8A_HW9 - Homework 9: Participant in a Study Due: 5:00pm,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 9: Participant in a Study Due: 5:00pm, Thursday, March 10th Set Up o Open your home directory (double click on your cs8wxx icon; 2 nd icon from the top) and create a new directory in your home directory called hw9 (all lowercase). o Copy the folder bookClasses from your Desktop into the hw9 directory. Right click on bookClasses > Copy > Right click on hw9 > Paste Into Folder. o When you work in Dr. Java be sure you are editing files in the hw9/bookClasses directory. Problems 1. Participant In this assignment you will create a Participant Class. Then you will test your class with a tester application we provide. You should read the descriptions of the Participant class methods below, but then open and read the tester application's main() method in detail before you write your code (so you understand how your methods will be used.) The Participant class will have the following features. h Private Instance Variables: name - the name of the participant, this should be a String weight - the weight of the participant, this should be an int height - the height of the participant, this should be a double h You are responsible for creating three constructors appropriate for the instance variables. The first constructor should have no parameters and set the instance variables to default values. (default name: "Joe Bob", default weight: 1, default height: 1.0). The second constructor should have only one parameter (a String to set the name), the other two instance variables should be set to default values. The third construction should have an appropriate number of parameters to set every instance variable. If weight or height is negative, this constructor should not set weight or height, instead it should print "Incorrect height, height must be positive. Height will not be set." or "Incorrect weight, weight must be positive. Weight will not be set." and
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/31/2011 for the course CSE 8a taught by Professor Kube,p during the Fall '08 term at UCSD.

Page1 / 4

CSE8A_HW9 - Homework 9: Participant in a Study Due: 5:00pm,...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online