not a lab3 lab3
This commit is contained in:
parent
049b6b9dae
commit
cc8c60cd6a
@ -36,8 +36,8 @@ public class MP1_CalebFontenot {
|
||||
{1, 3, 9, 1, 4, 0, 7},
|
||||
{3, 3, 3, 9, 4, 0, 7}
|
||||
};
|
||||
printArray(intArray3);
|
||||
System.out.println(isConsecutiveFour(intArray3));
|
||||
printArray(intArray1);
|
||||
System.out.println(isConsecutiveFour(intArray1));
|
||||
}
|
||||
|
||||
public static void printArray(int[][] array)
|
||||
@ -103,7 +103,8 @@ public class MP1_CalebFontenot {
|
||||
System.out.println("Checking for Diagonal matches...");
|
||||
for (int rowIterate = 0; rowIterate < (values.length - 4); ++rowIterate) {
|
||||
for (int x = 0; x < values.length - 1; ++x) {
|
||||
if (values[x][rowIterate] == values[x][rowIterate + 1])
|
||||
if (values[x][rowIterate] == values[x][rowIterate + 1]) {}
|
||||
|
||||
}
|
||||
System.out.println("Checking next line...");
|
||||
}
|
||||
|
BIN
Semester 2/Assignments/lab3_CalebFontenot/lab1-2.pdf
Normal file
BIN
Semester 2/Assignments/lab3_CalebFontenot/lab1-2.pdf
Normal file
Binary file not shown.
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.calebfontenot.lab3_calebfontenot;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Account {
|
||||
|
||||
public Account()
|
||||
{
|
||||
dateCreated = new Date();
|
||||
}
|
||||
public Account(double balance) {
|
||||
this.balance = balance;
|
||||
dateCreated = new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Account{" + "id=" + id + ", balance=" + balance + ", dateCreated=" + dateCreated + '}';
|
||||
}
|
||||
|
||||
private int id;
|
||||
private double balance;
|
||||
private static int annualInterestRate;
|
||||
private Date dateCreated;
|
||||
|
||||
/**
|
||||
* Get the value of id
|
||||
*
|
||||
* @return the value of id
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of id
|
||||
*
|
||||
* @param id new value of id
|
||||
*/
|
||||
public void setId(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of balance
|
||||
*
|
||||
* @return the value of balance
|
||||
*/
|
||||
public double getBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of balance
|
||||
*
|
||||
* @param balance new value of balance
|
||||
*/
|
||||
public void setBalance(double balance)
|
||||
{
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of annualInterestRate
|
||||
*
|
||||
* @return the value of annualInterestRate
|
||||
*/
|
||||
public static int getAnnualInterestRate()
|
||||
{
|
||||
return annualInterestRate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of annualInterestRate
|
||||
*
|
||||
* @param annualInterestRate new value of annualInterestRate
|
||||
*/
|
||||
public static void setAnnualInterestRate(int annualInterestRate)
|
||||
{
|
||||
Account.annualInterestRate = annualInterestRate;
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Account account1 = new Account();
|
||||
Account account2 = new Account(100);
|
||||
|
||||
System.out.println(account1);
|
||||
System.out.println(account2);
|
||||
}
|
||||
}
|
@ -12,6 +12,9 @@ public class Employee {
|
||||
|
||||
private String name;
|
||||
|
||||
public Employee () {
|
||||
|
||||
}
|
||||
public Employee(String name)
|
||||
{
|
||||
this.name = name;
|
||||
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package jan17;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class Circle {
|
||||
static int numberOfObjectsRunning;
|
||||
double radius;
|
||||
public int forEverybody = 0;
|
||||
|
||||
public Circle()
|
||||
{
|
||||
numberOfObjectsRunning++;
|
||||
}
|
||||
|
||||
public Circle(double radius)
|
||||
{
|
||||
numberOfObjectsRunning++;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of radius
|
||||
*
|
||||
* @return the value of radius
|
||||
*/
|
||||
public double getRadius()
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of radius
|
||||
*
|
||||
* @param radius new value of radius
|
||||
*/
|
||||
public void setRadius(double radius)
|
||||
{
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
private Date dateOfCreation;
|
||||
|
||||
/**
|
||||
* Get the value of dateOfCreation
|
||||
*
|
||||
* @return the value of dateOfCreation
|
||||
*/
|
||||
public Date getDateOfCreation()
|
||||
{
|
||||
return dateOfCreation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of dateOfCreation
|
||||
*
|
||||
* @param dateOfCreation new value of dateOfCreation
|
||||
*/
|
||||
public void setDateOfCreation(Date dateOfCreation)
|
||||
{
|
||||
this.dateOfCreation = dateOfCreation;
|
||||
}
|
||||
|
||||
public double getArea() {
|
||||
return Math.PI * (this.radius * this.radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Circle{" + "radius=" + radius + ", dateOfCreation=" + dateOfCreation + '}';
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// new Circle objects
|
||||
System.out.println("Number of objects: " + Circle.numberOfObjectsRunning);
|
||||
Circle c1 = new Circle();
|
||||
System.out.println("Number of objects: " + Circle.numberOfObjectsRunning);
|
||||
Circle c2 = new Circle(2.0);
|
||||
System.out.println("Number of objects: " + Circle.numberOfObjectsRunning);
|
||||
|
||||
// two ways to set the radius
|
||||
c1.radius = 10.0;
|
||||
c1.setRadius(10.0);
|
||||
|
||||
// two ways to get the radius
|
||||
System.out.println("radius of c1: " + c1.radius);
|
||||
System.out.println("radius of c1: " + c1.getRadius());
|
||||
|
||||
System.out.println("radius of c1: " + c2.radius);
|
||||
System.out.println("radius of c1: " + c2.getRadius());
|
||||
|
||||
// use object's methods
|
||||
System.out.println("area of c1: " + c1.getArea());
|
||||
System.out.println("area of c2: " + c2.getArea());
|
||||
|
||||
System.out.println(c1.getDateOfCreation());
|
||||
|
||||
c1.setDateOfCreation(new Date());
|
||||
|
||||
System.out.println(c1.getDateOfCreation());
|
||||
|
||||
Random rng = new Random();
|
||||
System.out.println(rng.nextDouble());
|
||||
System.out.println(new java.util.Random().nextInt());
|
||||
System.out.println(c1);
|
||||
System.out.println(c1.toString());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package jan17;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class TestCircle {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Circle c1 = new Circle();
|
||||
System.out.println(c1.radius);
|
||||
System.out.println(c1);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package jan17.x;
|
||||
|
||||
import jan17.Circle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class TestPublic {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Circle c1 = new Circle();
|
||||
System.out.println(c1.forEverybody);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user