This commit is contained in:
2023-02-09 12:55:55 -06:00
parent 697b231cc7
commit 6ce8c0d880
26 changed files with 427 additions and 2 deletions

View File

@@ -1,116 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MyInteger.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
table {color: #888888; background-color: #313335; font-family: monospace}
.ST2 {color: #9876aa}
.ST3 {color: #ffc66d}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
.ST4 {color: #ffc66d; font-family: monospace; font-style: italic}
.ST6 {color: #9876aa; font-family: monospace; font-style: italic}
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
.ST0 {color: #287bde}
.literal {color: #cc7832}
.ST5 {font-family: monospace; font-style: italic}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/com/calebfontenot/lab3_calebfontenot/MyInteger.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab3_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> MyInteger {
<span class="literal">private</span> <span class="literal">int</span> <span class="ST2">value</span>;
<span class="comment">/**</span>
<span class="comment"> * </span><span class="comment">Get</span> <span class="comment">the</span> <span class="comment">value</span> <span class="comment">of</span> <span class="comment">value</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="ST1">@return</span> <span class="comment">the</span> <span class="comment">value</span> <span class="comment">of</span> <span class="comment">value</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">int</span> <span class="ST3">getValue</span>()
{
<span class="literal">return</span> <span class="literal">this</span>.<span class="ST2">value</span>;
}
@Override
<span class="literal">public</span> <span class="literal">int</span> <span class="ST3">hashCode</span>()
{
<span class="literal">int</span> hash = <span class="number">7</span>;
<span class="literal">return</span> hash;
}
@Override
<span class="literal">public</span> <span class="literal">boolean</span> <span class="ST3">equals</span>(Object obj)
{
<span class="literal">if</span> (<span class="literal">this</span> == obj) {
<span class="literal">return</span> <span class="literal">true</span>;
}
<span class="literal">if</span> (obj == <span class="literal">null</span>) {
<span class="literal">return</span> <span class="literal">false</span>;
}
<span class="literal">if</span> (getClass() != obj.getClass()) {
<span class="literal">return</span> <span class="literal">false</span>;
}
<span class="literal">final</span> MyInteger other = (MyInteger) obj;
<span class="literal">return</span> <span class="literal">this</span>.<span class="ST2">value</span> == other.<span class="ST2">value</span>;
}
@Override
<span class="literal">public</span> String <span class="ST3">toString</span>()
{
<span class="literal">return</span> <span class="string">&quot;</span><span class="string">MyInteger{</span><span class="string">&quot;</span> + <span class="string">&quot;</span><span class="string">value=</span><span class="string">&quot;</span> + <span class="ST2">value</span> + <span class="string">&#39;</span><span class="string">}</span><span class="string">&#39;</span>;
}
<span class="literal">public</span> MyInteger(<span class="literal">int</span> value)
{
<span class="literal">this</span>.<span class="ST2">value</span> = value;
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">boolean</span> <span class="ST4">isEven</span>(MyInteger other) {
<span class="literal">return</span> other.getValue() % <span class="number">2</span> == <span class="number">0</span>;
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">boolean</span> <span class="ST4">isPrime</span>(MyInteger other) {
<span class="literal">int</span> numToTest = other.getValue();
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">2</span>; i &lt;= numToTest / <span class="number">2</span>; ++i) {
<span class="literal">if</span> (numToTest % i == <span class="number">0</span>) {
<span class="literal">return</span> <span class="literal">false</span>;
}
}
<span class="literal">return</span> <span class="literal">true</span>;
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">int</span> <span class="ST4">parseInteger</span>(<span class="literal">char</span>[] array) {
String s = <span class="string">&quot;&quot;</span>;
<span class="literal">for</span> (<span class="literal">char</span> i: array) {
s += i;
}
<span class="literal">return</span> Integer.<span class="ST5">parseInt</span>(String.<span class="ST5">valueOf</span>(s));
}
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args)
{
System.<span class="ST6">out</span>.println(<span class="ST5">p</span><span class="ST5">arseInteger</span>(<span class="literal">new</span> <span class="literal">char</span>[] {<span class="string">&#39;</span><span class="string">7</span><span class="string">&#39;</span>, <span class="string">&#39;</span><span class="string">6</span><span class="string">&#39;</span>}));
System.<span class="ST6">out</span>.println(MyInteger.<span class="ST5">isPrime</span>(<span class="literal">new</span> MyInteger(<span class="number">3</span>)));
System.<span class="ST6">out</span>.println(MyInteger.<span class="ST5">isEven</span>(<span class="literal">new</span> MyInteger(<span class="number">4</span>)));
System.<span class="ST6">out</span>.println(MyInteger.<span class="ST5">isEven</span>(<span class="literal">new</span> MyInteger(<span class="number">3</span>)));
}
}
</pre></body>
</html>

Binary file not shown.

View File

@@ -7,8 +7,8 @@
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<exec.mainClass>com.calebfontenot.lab3_calebfontenot.Lab3_CalebFontenot</exec.mainClass>
</properties>
</project>

View File

@@ -1,146 +0,0 @@
/*
* 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;
import java.util.Objects;
/**
*
* @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);
System.out.println(account1.equals(account2));
System.out.println(account1.equals(new A()));
}
public void withdraw(double amount) {
this.balance -= amount;
}
// public void withdraw(double amount) {
// this.balance -= amount;
// }
@Override
public int hashCode()
{
int hash = 3;
return hash;
}
@Override
public boolean equals(Object obj)
{
// If the parameter obj is the same as this object
if (this == obj) { // compare addresses
return true;
}
if (obj == null) { // parameter is null
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
// here we are certain
final Account other = (Account) obj;
if (this.id != other.id) {
return false;
}
if (Double.doubleToLongBits(this.balance) != Double.doubleToLongBits(other.balance)) {
return false;
}
return Objects.equals(this.dateCreated, other.dateCreated);
}
}class A {}

View File

@@ -1,53 +0,0 @@
/*
* 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;
/**
*
* @author caleb
*/
public class Employee {
private String name;
public Employee () {
}
public Employee(String name)
{
this.name = name;
}
/**
* Get the value of name
*
* @return the value of name
*/
public String getName()
{
return name;
}
/**
* Set the value of name
*
* @param name new value of name
*/
public void setName(String name)
{
this.name = name;
}
public static void main(String[] args)
{
Employee e = new Employee();
e.setName("John Wayne");
System.out.println(e.getName());
Employee e1 = new Employee("Mary Poppins");
System.out.println(e1.getName());
}
}

View File

@@ -0,0 +1,138 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.calebfontenot.lab3_calebfontenot;
/**
*
* @author caleb
*/
public class Fan {
// Constants
public static final int SLOW = 1;
public static final int MEDIUM = 2;
public static final int FAST = 3;
private int speed;
private boolean isOn;
private int radius;
private String color;
public Fan() {
this.speed = 1;
this.isOn = false;
this.radius = 5;
this.color = "blue";
}
/**
* Get the value of color
*
* @return the value of color
*/
public String getColor()
{
return color;
}
/**
* Set the value of color
*
* @param color new value of color
*/
public void setColor(String color)
{
this.color = color;
}
/**
* Get the value of radius
*
* @return the value of radius
*/
public int getRadius()
{
return radius;
}
/**
* Set the value of radius
*
* @param radius new value of radius
*/
public void setRadius(int radius)
{
this.radius = radius;
}
/**
* Get the value of isOn
*
* @return the value of isOn
*/
public boolean isOn()
{
return isOn;
}
/**
* Set the value of isOn
*
* @param isOn new value of isOn
*/
public void setOn(boolean isOn)
{
this.isOn = isOn;
}
/**
* Get the value of speed
*
* @return the value of speed
*/
public int getSpeed()
{
return speed;
}
/**
* Set the value of speed
*
* @param speed new value of speed
*/
public void setSpeed(int speed)
{
this.speed = speed;
}
@Override
public String toString()
{
String returnString;
if (this.isOn) {
returnString = "fan is on. ";
}
else {
returnString = "fan is off. ";
}
returnString += "{" + "speed=" + speed + ", radius=" + radius + ", color=" + color + '}';
return returnString;
}
public static void main(String[] args)
{
Fan fan1 = new Fan();
fan1.setSpeed(Fan.FAST);
fan1.setRadius(10);
fan1.setColor("yellow");
fan1.setOn(true);
System.out.println(fan1);
Fan fan2 = new Fan();
fan2.setSpeed(Fan.MEDIUM);
fan2.setRadius(5);
fan2.setColor("blue");
fan2.setOn(false);
System.out.println(fan2.toString());
}
}

View File

@@ -0,0 +1,79 @@
/*
* 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.Scanner;
/**
*
* @author caleb
*/
public class FanList {
private Fan[] list;
// A constructor that creates a list of type fan
public FanList(int listSize)
{
list = new Fan[listSize];
createListObjects();
}
// Creates a list of Fan objects from User's input
private void createListObjects()
{
Scanner scan = new Scanner(System.in);
for (int i = 0; i < list.length; ++i) {
Fan fan = new Fan();
System.out.println("Enter FAN data for fan " + (i + 1)
+ ": color, radius, speed(1, 2 or 3) and if on (t, f)");
String color = scan.next();
int radius = scan.nextInt();
int speed = scan.nextInt();
String on = scan.next();
fan.setSpeed(speed);
fan.setRadius(radius);
fan.setColor(color);
if ("t".compareToIgnoreCase(on) == 0) {
fan.setOn(true);
} else {
fan.setOn(false);
}
list[i] = fan;
System.out.println("----------------------------------------");
}
}
@Override
public String toString()
{
String s = "FanList{" + "list=\n";
for (int i = 0; i < list.length; ++i) {
s += list[i].toString() + "\n-----------------------\n";
}
s += '}';
return s;
}
public void sortListByRadius()
{
for (int i = 0; i < list.length - 1; ++i) {
for (int j = i + 1; j < list.length; ++j) {
if (list[i].getRadius() > list[j].getRadius()) {
Fan temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
}
}
public static void main(String[] args)
{
FanList fanList = new FanList(3);
System.out.println(fanList);
fanList.sortListByRadius();
System.out.println(fanList.toString());
}
}

View File

@@ -1,16 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.calebfontenot.lab3_calebfontenot;
/**
*
* @author caleb
*/
public class Lab3_CalebFontenot {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}

View File

@@ -1,85 +0,0 @@
/*
* 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;
/**
*
* @author caleb
*/
public class MyInteger {
private int value;
/**
* Get the value of value
*
* @return the value of value
*/
public int getValue()
{
return this.value;
}
@Override
public int hashCode()
{
int hash = 7;
return hash;
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MyInteger other = (MyInteger) obj;
return this.value == other.value;
}
@Override
public String toString()
{
return "MyInteger{" + "value=" + value + '}';
}
public MyInteger(int value)
{
this.value = value;
}
public static boolean isEven(MyInteger other) {
return other.getValue() % 2 == 0;
}
public static boolean isPrime(MyInteger other) {
int numToTest = other.getValue();
for (int i = 2; i <= numToTest / 2; ++i) {
if (numToTest % i == 0) {
return false;
}
}
return true;
}
public static int parseInteger(char[] array) {
String s = "";
for (char i: array) {
s += i;
}
return Integer.parseInt(String.valueOf(s));
}
public static void main(String[] args)
{
System.out.println(parseInteger(new char[] {'7', '6'}));
System.out.println(MyInteger.isPrime(new MyInteger(3)));
System.out.println(MyInteger.isEven(new MyInteger(4)));
System.out.println(MyInteger.isEven(new MyInteger(3)));
}
}

View File

@@ -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 com.calebfontenot.lab3_calebfontenot;
/**
*
* @author caleb
*/
public class Stock {
private String symbol;
private String name;
private double previousClosingPrice;
private double currentPrice;
/**
* Get the value of currentPrice
*
* @return the value of currentPrice
*/
public double getCurrentPrice()
{
return currentPrice;
}
/**
* Set the value of currentPrice
*
* @param currentPrice new value of currentPrice
*/
public void setCurrentPrice(double currentPrice)
{
this.currentPrice = currentPrice;
}
/**
* Get the value of previousClosingPrice
*
* @return the value of previousClosingPrice
*/
public double getPreviousClosingPrice()
{
return previousClosingPrice;
}
/**
* Set the value of previousClosingPrice
*
* @param previousClosingPrice new value of previousClosingPrice
*/
public void setPreviousClosingPrice(double previousClosingPrice)
{
this.previousClosingPrice = previousClosingPrice;
}
/**
* Get the value of name
*
* @return the value of name
*/
public String getName()
{
return name;
}
/**
* Set the value of name
*
* @param name new value of name
*/
public void setName(String name)
{
this.name = name;
}
/**
* Get the value of symbol
*
* @return the value of symbol
*/
public String getSymbol()
{
return symbol;
}
/**
* Set the value of symbol
*
* @param symbol new value of symbol
*/
public void setSymbol(String symbol)
{
this.symbol = symbol;
}
public double getChangePercent() {
return this.currentPrice - this.previousClosingPrice;
//(((this.previousClosingPrice - this.currentPrice) / Math.abs(this.previousClosingPrice)) * 100)
}
@Override
public String toString()
{
return "Stock{" + "symbol=" + symbol + ", name=" + name + ", previousClosingPrice=" + previousClosingPrice + ", currentPrice=" + currentPrice + "}"+ "\n" + "Change in Percent: " + this.getChangePercent();
}
public static void main(String[] args)
{
Stock stock1 = new Stock();
stock1.setSymbol("ORCL");
stock1.setName("Oracle Corporation");
stock1.setPreviousClosingPrice(34.5);
stock1.setCurrentPrice(34.35);
System.out.println(stock1);
}
}

View File

@@ -0,0 +1,75 @@
/*
* 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.Scanner;
/**
*
* @author caleb
*/
public class StockList {
private Stock[] list;
// A constructor that creates a list of type stock
public StockList(int listSize)
{
list = new Stock[listSize];
createListObjects();
}
// Creates a list of Fan objects from User's input
private void createListObjects()
{
Scanner scan = new Scanner(System.in);
for (int i = 0; i < list.length; ++i) {
Stock stock = new Stock();
System.out.println("Enter Stock data for stock " + (i + 1)
+ ": symbol, name, previous closing price, and current price");
String symbol = scan.next();
String name = scan.next();
double previousClosingPrice = scan.nextDouble();
double currentPrice = scan.nextDouble();
stock.setSymbol(symbol);
stock.setName(name);
stock.setPreviousClosingPrice(previousClosingPrice);
stock.setCurrentPrice(currentPrice);
list[i] = stock;
System.out.println("----------------------------------------");
}
}
@Override
public String toString()
{
String s = "StockList{" + "list=\n";
for (int i = 0; i < list.length; ++i) {
s += list[i].toString() + "\n-----------------------\n";
}
s += '}';
return s;
}
public void sortByChangeInPercentage()
{
for (int i = 0; i < list.length - 1; ++i) {
for (int j = i + 1; j < list.length; ++j) {
if (list[i].getChangePercent() > list[j].getChangePercent()) {
Stock temp = list[i];
list[i] = list[j];
list[j] = temp;
}
}
}
}
public static void main(String[] args)
{
StockList stockList = new StockList(3);
System.out.println(stockList);
stockList.sortByChangeInPercentage();
System.out.println(stockList);
}
}

View File

@@ -1,151 +0,0 @@
/*
* 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()
{
this(0);
numberOfObjectsRunning++;
}
public Circle(double radius)
{
numberOfObjectsRunning++;
this.radius = radius;
this.dateOfCreation = new Date();
}
/**
* 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;
}
public Circle getCircle() {
return this;
}
/**
* 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());
System.out.println();
printMultiples(c1, 4);
System.out.println();
Circle[] ar = new Circle[3];
ar[0] = c1;
ar[1] = new Circle(10);
ar[2] = new Circle(3.8);
Circle.printArray(ar);
System.out.println(c1.getCircle());
}
public static void printArray(Circle[] ar)
{
for (Circle ar1: ar) {
System.out.println(ar1);
}
}
public static void printMultiples(Circle c, int howManyTimes) {
for (int i = 0; i < howManyTimes; ++i) {
System.out.println(c);
}
}
}

View File

@@ -1,18 +0,0 @@
/*
* 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);
}
}

View File

@@ -1,20 +0,0 @@
/*
* 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 TestImmutable {
public static void main(String[] args)
{
Circle c = new Circle(10);
System.out.println(c);
Circle c1 = c.getCircle();
c1.getDateOfCreation().setTime(1234567);
System.out.println(c1);
}
}

View File

@@ -1,19 +0,0 @@
/*
* 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);
}
}