Feels about my programming final? Passed that shit!! It was both the hardest thing I've done for that class and also the best since it was straight programming.
Consisted of programming and manipulating arrays as well as working with classes/subclasses/extensions.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming
Last final of the semester. I could really use a perfect score and am studying hardcore for this. 5 hours down and counting.
Practice Problems for Final Exam
Write a method that can randomize the values in a 1-D integer array.
Write a method that can sort the values in a 1-D integer array.
Write a method that can reverse the values in a 1-D integer array.
Write a method that allows entering information into a person class.
Define a class called DateClass that has field members: mm, dd, and yy; and method members: mutators, accessors, constructors, EnterInfo, and PrintInfo.
Define a class called TimeClass that has field members: hh, mm, and ss, and method members: mutators, accessors, constructors, EnterInfo, and PrintInfo.
Define a DateTimeClass using the DateClass and TimeClass in it, so it has a "date" and "time" objects inside it (use keyword "new").
Program a MyClass that has the main() that uses the new DateClass to declare an array DateTimes, size 5, and enter information into the array within a "for" loop, and display their information by another "for" loop.
A different approach of combining date and time is to modify the DateClass so it includes (use keyword "extends") the DateClass. How do you do this?
Define a NameClass to have information of a person's last name, first name, and middle name. Again, program all the needed members like the original DateClass and TimeClass practices introduced above.
Can you also make a PetClass? The PetClass has a name, birth date, and physical information: a PhysiqueClass that has length and weight.
Define a PersonClass to have information of a person's name, birth date, and physical information. Use the NameClass, DateClass, and PhysiqueClass to defined above.
Define an AddressClass to have information of a street address: number, street name, city, state, and zip code. Again, program all the needed members.
Can you build a HouseClass that has a person, a pet, and an address; by using the PersonClass, PetClass, and AddressClass?
Can you program a MyClass that creates two houses with the HouseClass above, enter their information, and print out their information?
Study for understanding the following terms:
identifiers
object/instance
scope: local/global
static/non-static
public/private
class members
inheritance
constructor
mutator
accessor
overloading
Best lab by far. I was excited programming this and having it work perfectly. I'm not too excited now seeing how much of this is on the final.
//Christopher Smith
//Lab 13 Classes, Extends
//
import java.util.Scanner; //keyboard input
public class lab13 {
public static void main (String[] args) {
HouseClass house1 = new HouseClass();
HouseClass house2 = new HouseClass();
//take input referring to sub class EnterInfo in both petclass and dateclass
System.out.println("Enter your information");
house1.EnterInfo();
System.out.println();
System.out.println("Enter your information");
house2.EnterInfo();
System.out.println();
//printing the entered info back out
house1.PrintInfo();
System.out.println();
house2.PrintInfo();
System.out.println();
}
}
------------------------------------------------------------------------------------------------
//Christopher Smith
//CSC 15 Lab 13 Classes, Extends
//HouseClass
import java.util.Scanner;
public class HouseClass extends PersonClass{ //chain of events, pulls info from PersonClass which extends down through all other classes
private String address,acre;
//accessor
public String GetAddress() {return address;}
public String GetAcre() {return acre;}
//mutator
public void SetAddress(String address_given){address=address_given;}
public void SetAcre(String acre_given){acre=acre_given;}
//print info (includes PersonClass and downward)
public void PrintInfo(){
System.out.println("Address is "+GetAddress());
System.out.println("Acreage is "+GetAcre());
super.PrintInfo(); //PrintInfo from PersonClass
}
//keyboard input
public void EnterInfo(){
Scanner kb = new Scanner (System.in);
System.out.print("Enter Address");
SetAddress(kb.nextLine());
System.out.print("Enter Acreage");
SetAcre(kb.nextLine());
super.EnterInfo();
}
}
--------------------------------------------------------------------------------
//Christopher Smith
//Lab 13 Classes, Extends
//PersonClass
import java.util.Scanner;
public class PersonClass extends PetClass{ //pulling all info from PetClass which also pulls info from DateClass
private String PersonName;
public int m,d,y;
//accessor
public String GetPersonName() {return PersonName;}
//mutator
public void SetPersonName(String PersonName_given){PersonName=PersonName_given;}
//print info (includes PetClass which includes DateClass)
public void PrintInfo(){
System.out.println("Name is "+GetPersonName());
System.out.println("Born "+m+"/"+"/"+d+"/"+y);
super.PrintInfo(); //printing info from PetClass
}
//keyboard input (for entry to name as well as PetClass and downward)
public void EnterInfo(){
Scanner kb = new Scanner (System.in); //keyboard input
System.out.print("Enter person's name");
SetPersonName(kb.nextLine());
System.out.print("Enter person's birthday");
System.out.print("Enter month");
m = kb.nextInt();
System.out.print("Enter day");
d = kb.nextInt();
System.out.print("Enter Year");
y = kb.nextInt();
super.EnterInfo();//pulling up PetClass EnterInfo()
}
}
-----------------------------------------------------------------------------------
//Christopher Smith
//CSC 15 Lab13 taken from lab 12
//Classes, Extends
//PetClass
import java.util.Scanner;
public class PetClass extends DateClass {
private String name,weight,length; //private string variables for use in this class
//accessor (makes private variables into a public available variable)
public String GetName() {return name;}
public String GetWeight() {return weight;}
public String GetLength() {return length;}
//mutator (uses private variables to modify the data stored in them)
public void SetName (String name_given){name=name_given;}
public void SetWeight (String weight_given){weight=weight_given;}
public void SetLength (String length_given){length=length_given;}//variable length_given used from keyboard input
/*
It's almost like with accessors and mutators everythings backwards. Your keyboard input goes into
the mutator which feeds into the accessor.
*/
//sub class used for displaying everything in petClass and dateClass
public void PrintInfo() {
System.out.println("Name is "+GetName());
System.out.println("Weight is "+GetWeight());
System.out.println("Length is "+GetLength());
System.out.print("Birthdate ");
super.PrintInfo();//pulls birthdate info from my date class
}
//keyboard input used by mutator
public void EnterInfo() {
Scanner kb = new Scanner (System.in); //keyboard input defined as kb
System.out.print("Enter Pet's Name: ");
SetName(kb.nextLine()); //next string entry before enter used for kb input, sets name.
System.out.print("Enter Weight: ");
SetWeight(kb.nextLine());//next string sets pet weight
System.out.print("Enter Length: ");
SetLength(kb.nextLine());//next string sets pet length
System.out.print("Enter Pet's Birthdate: ");
super.EnterInfo();//writing to dateclass enterinfo
}
}
----------------------------------------------------------------------------------------------------------------------
//Christopher Smith
//CSC 15 lab 13 Classes, Extends
//DateClass
import java.util.Scanner;
public class DateClass { //public so can be called upon by other classes
private int mm, dd, yy; //private variables for this class only; used to store integers for date
//accessor used to create public accessible variables for use in other classes
public int GetMM() {return mm;}
public int GetDD() {return dd;}
public int GetYY() {return yy;}
//mutators, calls upon keyboard input to modify the variables
public void SetMM (int mm_given){mm=mm_given;}
public void SetDD (int dd_given){dd=dd_given;}
public void SetYY (int yy_given){yy=yy_given;}
//information display
public void PrintInfo() {
System.out.println("Date is: "+GetMM()+"/"+GetDD()+"/"+GetYY());
}
//for keyboard input to be used by mutator
public void EnterInfo() {
Scanner kb = new Scanner (System.in); //keyboard input defined as kb
System.out.print("Enter Month: ");
SetMM(kb.nextInt());
System.out.print("Enter Day: ");
SetDD(kb.nextInt());
System.out.print("Enter Year: ");
SetYY(kb.nextInt());
}
}
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
✓ Live Streaming✓ Interactive Chat✓ Private Shows✓ HD Quality✓ Free Actions
Free to watch • No registration required • HD streaming