Initial Commit
This commit is contained in:
8
Source Code/Final/.idea/.gitignore
generated
vendored
Normal file
8
Source Code/Final/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../:\ProgrammingProjects\JavaProjects\JavaYear1\Final\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
7
Source Code/Final/.idea/codeStyles/Project.xml
generated
Normal file
7
Source Code/Final/.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
5
Source Code/Final/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
Source Code/Final/.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
6
Source Code/Final/.idea/discord.xml
generated
Normal file
6
Source Code/Final/.idea/discord.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT" />
|
||||
</component>
|
||||
</project>
|
6
Source Code/Final/.idea/misc.xml
generated
Normal file
6
Source Code/Final/.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
Source Code/Final/.idea/modules.xml
generated
Normal file
8
Source Code/Final/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/Final.iml" filepath="$PROJECT_DIR$/Final.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
11
Source Code/Final/Final.iml
Normal file
11
Source Code/Final/Final.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
BIN
Source Code/Final/out/production/Final/19.jpg
Normal file
BIN
Source Code/Final/out/production/Final/19.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 MiB |
BIN
Source Code/Final/out/production/Final/25.jpg
Normal file
BIN
Source Code/Final/out/production/Final/25.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 968 KiB |
BIN
Source Code/Final/out/production/Final/26.jpg
Normal file
BIN
Source Code/Final/out/production/Final/26.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1003 KiB |
BIN
Source Code/Final/out/production/Final/8.jpg
Normal file
BIN
Source Code/Final/out/production/Final/8.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
BIN
Source Code/Final/out/production/Final/DigitsCheckerGUI.class
Normal file
BIN
Source Code/Final/out/production/Final/DigitsCheckerGUI.class
Normal file
Binary file not shown.
@ -0,0 +1,68 @@
|
||||
public class FarmBoxCustomer {
|
||||
static int customerNumberCurrentNumber = 10000;
|
||||
final int customerNumber;
|
||||
int numberOfFamilies;
|
||||
|
||||
|
||||
|
||||
public FarmBoxCustomer(int numberOfFamiliesIn) {
|
||||
customerNumber = customerNumberCurrentNumber;
|
||||
customerNumberCurrentNumber++;
|
||||
numberOfFamilies = numberOfFamiliesIn;
|
||||
|
||||
}
|
||||
final int maxNumberOfProducts = numberOfFamilies * 14;
|
||||
FarmProduct[] listOfProducts = new FarmProduct[maxNumberOfProducts];
|
||||
|
||||
public int getInstance() {
|
||||
return customerNumber;
|
||||
}
|
||||
|
||||
public boolean addProduct(FarmProduct productIn) {
|
||||
for(FarmProduct product: listOfProducts) {
|
||||
if (product == null) {
|
||||
product = productIn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeProduct(FarmProduct productIn) {
|
||||
for (int i = 0; i < listOfProducts.length; i++) {
|
||||
if (listOfProducts[i] == productIn) {
|
||||
FarmProduct[] newListOfProducts = new FarmProduct[maxNumberOfProducts];
|
||||
for (int k = 0; k < listOfProducts.length; k++) {
|
||||
if (i == k) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
newListOfProducts[k] = listOfProducts [i];
|
||||
}
|
||||
}
|
||||
listOfProducts = newListOfProducts;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
public String getProducts() {
|
||||
String list = "";
|
||||
int counter = 1;
|
||||
for (FarmProduct product: listOfProducts) {
|
||||
list += counter + " " + product.getDescription() + "\n";
|
||||
counter++;
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public double getCost() {
|
||||
double cost = 0;
|
||||
for (FarmProduct product: listOfProducts) {
|
||||
cost += product.getCost();
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
}
|
29
Source Code/Final/out/production/Final/FarmProduct.java.old
Normal file
29
Source Code/Final/out/production/Final/FarmProduct.java.old
Normal file
@ -0,0 +1,29 @@
|
||||
public class FarmProduct {
|
||||
private String description;
|
||||
private double cost;
|
||||
|
||||
public FarmProduct (String descIn, double costIn) {
|
||||
description = descIn;
|
||||
cost = costIn;
|
||||
}
|
||||
|
||||
public String getDescription () {
|
||||
return description;
|
||||
}
|
||||
|
||||
public double getCost () {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void setDescription (String descIn) {
|
||||
description = descIn;
|
||||
}
|
||||
|
||||
public void setcost (double costIn) {
|
||||
cost = costIn;
|
||||
}
|
||||
|
||||
public boolean equals (FarmProduct other) {
|
||||
return other.description.equals(this.description) && other.cost==this.cost;
|
||||
}
|
||||
}
|
36
Source Code/Final/out/production/Final/Main.java.old
Normal file
36
Source Code/Final/out/production/Final/Main.java.old
Normal file
@ -0,0 +1,36 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
double[] blah = new double[]{5.0, 6.5, 7.0, 4.25, 8.0, 7.5};
|
||||
double[] blur= new double[]{7.5, 10.0, 8.0, 9.5, 6.75};
|
||||
System.out.println(getAdjustedQuizAverage(blah));
|
||||
System.out.println(getAdjustedQuizAverage(blur));
|
||||
}
|
||||
public static double getAdjustedQuizAverage(double[] quizScores) {
|
||||
int lowestScorePosition=quizScores.length-1;
|
||||
|
||||
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
if (quizScores[i] < quizScores[quizScores.length-1]) {
|
||||
lowestScorePosition = i;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quizScores[lowestScorePosition] = quizScores[quizScores.length-1];
|
||||
|
||||
double sum = 0;
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
sum += quizScores[i];
|
||||
}
|
||||
|
||||
return sum/(quizScores.length-1);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
public class NonProfitFarmBoxCustomer extends FarmBoxCustomer {
|
||||
String dropOffLocation;
|
||||
public NonProfitFarmBoxCustomer (int numberOfFamilies, String dropOffLocation) {
|
||||
super(numberOfFamilies);
|
||||
this.dropOffLocation = dropOffLocation;
|
||||
}
|
||||
public NonProfitFarmBoxCustomer (int numberOfFamilies) {
|
||||
super(numberOfFamilies);
|
||||
}
|
||||
|
||||
public String getDropOffLocation() {
|
||||
return dropOffLocation;
|
||||
}
|
||||
|
||||
public void setDropOffLocation(String dropOffLocation) {
|
||||
this.dropOffLocation = dropOffLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCost() {
|
||||
double beforeCost = super.getCost();
|
||||
beforeCost = beforeCost * 0.85;
|
||||
|
||||
if (dropOffLocation != null)
|
||||
beforeCost += 12.75;
|
||||
|
||||
return beforeCost;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
public static double getAdjustedQuizAverage(double[] quizScores) {
|
||||
int lowestScorePosition=quizScores.length-1;
|
||||
|
||||
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
if (quizScores[i] < quizScores[quizScores.length-1]) {
|
||||
lowestScorePosition = i;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quizScores[lowestScorePosition] = quizScores[quizScores.length-1];
|
||||
|
||||
double sum = 0;
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
sum += quizScores[i];
|
||||
}
|
||||
|
||||
return sum/(quizScores.length-1);
|
||||
}
|
62
Source Code/Final/src/DigitsCheckerGUI.java
Normal file
62
Source Code/Final/src/DigitsCheckerGUI.java
Normal file
@ -0,0 +1,62 @@
|
||||
import javafx.application.Application;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.event.ActionEvent;
|
||||
|
||||
public class DigitsCheckerGUI extends Application {
|
||||
|
||||
private Button[] buttons = new Button[2];
|
||||
private TextField inputField;
|
||||
private Text answer;
|
||||
|
||||
public void start (Stage primaryStage) {
|
||||
|
||||
primaryStage.setTitle("Digit Checker");
|
||||
|
||||
Label fieldLabel = new Label ("Enter an integer to check:");
|
||||
inputField = new TextField ();
|
||||
inputField.setPrefWidth (100);
|
||||
|
||||
String[] buttonsText = {"Number of Odd Digits?", "Adjacent Duplicate Digits?"};
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
buttons[i] = new Button(buttonsText[i]);
|
||||
// ********** Add ONE line of source code here (inside the for loop):
|
||||
buttons[i] = buttons[i].setOnAction(this::processDigitsCheck);
|
||||
|
||||
}
|
||||
|
||||
answer = new Text ("Ready to help you!");
|
||||
|
||||
FlowPane pane =
|
||||
new FlowPane (fieldLabel, inputField, buttons[0], buttons[1], answer);
|
||||
pane.setAlignment(Pos.CENTER);
|
||||
pane.setHgap (10);
|
||||
pane.setVgap (20);
|
||||
|
||||
Scene scene = new Scene (pane, 400, 200);
|
||||
|
||||
// ********** Add TWO lines of source code here (inside the start method):
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
|
||||
|
||||
}//end start method
|
||||
|
||||
|
||||
public void processDigitsCheck (ActionEvent event) {
|
||||
// ********** Complete the body of this processDigitsCheck method:
|
||||
// (Add as many lines as you need inside this method.)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//end processDigitsCheck method
|
||||
|
||||
}//end class
|
68
Source Code/Final/src/FarmBoxCustomer.java.old
Normal file
68
Source Code/Final/src/FarmBoxCustomer.java.old
Normal file
@ -0,0 +1,68 @@
|
||||
public class FarmBoxCustomer {
|
||||
static int customerNumberCurrentNumber = 10000;
|
||||
final int customerNumber;
|
||||
int numberOfFamilies;
|
||||
|
||||
|
||||
|
||||
public FarmBoxCustomer(int numberOfFamiliesIn) {
|
||||
customerNumber = customerNumberCurrentNumber;
|
||||
customerNumberCurrentNumber++;
|
||||
numberOfFamilies = numberOfFamiliesIn;
|
||||
|
||||
}
|
||||
final int maxNumberOfProducts = numberOfFamilies * 14;
|
||||
FarmProduct[] listOfProducts = new FarmProduct[maxNumberOfProducts];
|
||||
|
||||
public int getInstance() {
|
||||
return customerNumber;
|
||||
}
|
||||
|
||||
public boolean addProduct(FarmProduct productIn) {
|
||||
for(FarmProduct product: listOfProducts) {
|
||||
if (product == null) {
|
||||
product = productIn;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeProduct(FarmProduct productIn) {
|
||||
for (int i = 0; i < listOfProducts.length; i++) {
|
||||
if (listOfProducts[i] == productIn) {
|
||||
FarmProduct[] newListOfProducts = new FarmProduct[maxNumberOfProducts];
|
||||
for (int k = 0; k < listOfProducts.length; k++) {
|
||||
if (i == k) {
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
newListOfProducts[k] = listOfProducts [i];
|
||||
}
|
||||
}
|
||||
listOfProducts = newListOfProducts;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
public String getProducts() {
|
||||
String list = "";
|
||||
int counter = 1;
|
||||
for (FarmProduct product: listOfProducts) {
|
||||
list += counter + " " + product.getDescription() + "\n";
|
||||
counter++;
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
|
||||
public double getCost() {
|
||||
double cost = 0;
|
||||
for (FarmProduct product: listOfProducts) {
|
||||
cost += product.getCost();
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
}
|
29
Source Code/Final/src/FarmProduct.java.old
Normal file
29
Source Code/Final/src/FarmProduct.java.old
Normal file
@ -0,0 +1,29 @@
|
||||
public class FarmProduct {
|
||||
private String description;
|
||||
private double cost;
|
||||
|
||||
public FarmProduct (String descIn, double costIn) {
|
||||
description = descIn;
|
||||
cost = costIn;
|
||||
}
|
||||
|
||||
public String getDescription () {
|
||||
return description;
|
||||
}
|
||||
|
||||
public double getCost () {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public void setDescription (String descIn) {
|
||||
description = descIn;
|
||||
}
|
||||
|
||||
public void setcost (double costIn) {
|
||||
cost = costIn;
|
||||
}
|
||||
|
||||
public boolean equals (FarmProduct other) {
|
||||
return other.description.equals(this.description) && other.cost==this.cost;
|
||||
}
|
||||
}
|
36
Source Code/Final/src/Main.java.old
Normal file
36
Source Code/Final/src/Main.java.old
Normal file
@ -0,0 +1,36 @@
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
double[] blah = new double[]{5.0, 6.5, 7.0, 4.25, 8.0, 7.5};
|
||||
double[] blur= new double[]{7.5, 10.0, 8.0, 9.5, 6.75};
|
||||
System.out.println(getAdjustedQuizAverage(blah));
|
||||
System.out.println(getAdjustedQuizAverage(blur));
|
||||
}
|
||||
public static double getAdjustedQuizAverage(double[] quizScores) {
|
||||
int lowestScorePosition=quizScores.length-1;
|
||||
|
||||
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
if (quizScores[i] < quizScores[quizScores.length-1]) {
|
||||
lowestScorePosition = i;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quizScores[lowestScorePosition] = quizScores[quizScores.length-1];
|
||||
|
||||
double sum = 0;
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
sum += quizScores[i];
|
||||
}
|
||||
|
||||
return sum/(quizScores.length-1);
|
||||
}
|
||||
}
|
29
Source Code/Final/src/NonProfitFarmBoxCustomer.java.old
Normal file
29
Source Code/Final/src/NonProfitFarmBoxCustomer.java.old
Normal file
@ -0,0 +1,29 @@
|
||||
public class NonProfitFarmBoxCustomer extends FarmBoxCustomer {
|
||||
String dropOffLocation;
|
||||
public NonProfitFarmBoxCustomer (int numberOfFamilies, String dropOffLocation) {
|
||||
super(numberOfFamilies);
|
||||
this.dropOffLocation = dropOffLocation;
|
||||
}
|
||||
public NonProfitFarmBoxCustomer (int numberOfFamilies) {
|
||||
super(numberOfFamilies);
|
||||
}
|
||||
|
||||
public String getDropOffLocation() {
|
||||
return dropOffLocation;
|
||||
}
|
||||
|
||||
public void setDropOffLocation(String dropOffLocation) {
|
||||
this.dropOffLocation = dropOffLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCost() {
|
||||
double beforeCost = super.getCost();
|
||||
beforeCost = beforeCost * 0.85;
|
||||
|
||||
if (dropOffLocation != null)
|
||||
beforeCost += 12.75;
|
||||
|
||||
return beforeCost;
|
||||
}
|
||||
}
|
27
Source Code/Final/src/getAdjustedQuizAverage.txt
Normal file
27
Source Code/Final/src/getAdjustedQuizAverage.txt
Normal file
@ -0,0 +1,27 @@
|
||||
public static double getAdjustedQuizAverage(double[] quizScores) {
|
||||
int lowestScorePosition=quizScores.length-1;
|
||||
|
||||
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
if (quizScores[i] < quizScores[quizScores.length-1]) {
|
||||
lowestScorePosition = i;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
quizScores[lowestScorePosition] = quizScores[quizScores.length-1];
|
||||
|
||||
double sum = 0;
|
||||
for(int i=0; i < quizScores.length; i++) {
|
||||
if(i == quizScores.length-1)
|
||||
break;
|
||||
|
||||
sum += quizScores[i];
|
||||
}
|
||||
|
||||
return sum/(quizScores.length-1);
|
||||
}
|
BIN
Source Code/Final/src/src.zip
Normal file
BIN
Source Code/Final/src/src.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user