You are designing a program that will keep track of the boxes in a doctor's office. Each
Fantastic news! We've Found the answer you've been seeking!
Question:
- You are designing a program that will keep track of the boxes in a doctor's office. Each box will have three attributes: date, contents, and location. Write a class that will consist of box objects.
Public class Box
{
private String myDate;
private String myContents;
private String myLocation;
public class Box(String date, String contents, String location)
{
myDate = date;
myContents = contents;
myLocation = location;
- Continuing with the program in problem #1, create instances of the class for these boxes:
Box #23 contains medical records from 2016 and is in the storage closet.
Box #21 contains lotion samples manufactured in 2018 and is in the waiting room.
Box #07 contains flyers about the flu shot for 2020 and is in the receptionist's desk.
{
private String 2016;
private String medical records;
private String storage closer;
public class Box(2016, medical records, storage closet)
{
myDate = 2016;
myContents = medical records;
myLocation = storage closet;
}
}
- Continuing with the program in problem #2, write statements that will print out the date of box #23, the contents of box #07, and the location of box #21.
{
private String 2016;
private String medical records;
private String storage closer;
public class Box(2016, medical records, storage closet)
{
myDate = 2016;
myContents = medical records;
myLocation = storage closet;
}
}
- Continuing with the program in problem #3, write a method that could be used to tell if the attributes of two boxes are identical.
- Continuing with the program in problem #4: Box #10 has identical attributes to Box #07. Create box #10. Then, write two statements that will print out: one will compare the contents of Box #07 and Box #10, and the other will compare the contents of Box #21 and Box #23.
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date: