From 8e447756ac9ccc6a7ee2d71d565e1a5d49ee98cb Mon Sep 17 00:00:00 2001 From: LinlyBoi Date: Thu, 27 Jan 2022 19:21:54 +0200 Subject: [PATCH] Initial commit --- .gitignore | 2 + .idea/.gitignore | 8 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/uiDesigner.xml | 124 ++++++++++++++++++ DeansBequest.iml | 11 ++ src/Emploice/Employees.java | 26 ++++ src/Emploice/Programs.java | 24 ++++ .../ChocolateIceCreamMachine.java | 45 +++++++ src/IceCreamMachineStuff/IceCreamMachine.java | 62 +++++++++ src/IceCreamMachineStuff/MainProgram.java | 15 +++ src/Products/Product.class | Bin 0 -> 1222 bytes src/Products/Product.java | 48 +++++++ src/Products/ProductTests.java | 30 +++++ src/Questionaire/QuestionaireChecker.java | 55 ++++++++ src/Questionaire/Student.java | 29 ++++ src/Savings/SavingAccount.java | 39 ++++++ src/Savings/SavingForm.java | 16 +++ src/Student/Course.java | 41 ++++++ src/Student/Student.java | 30 +++++ src/coffee/Batch.java | 43 ++++++ src/coffee/Coffee.java | 48 +++++++ 22 files changed, 710 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 DeansBequest.iml create mode 100644 src/Emploice/Employees.java create mode 100644 src/Emploice/Programs.java create mode 100644 src/IceCreamMachineStuff/ChocolateIceCreamMachine.java create mode 100644 src/IceCreamMachineStuff/IceCreamMachine.java create mode 100644 src/IceCreamMachineStuff/MainProgram.java create mode 100644 src/Products/Product.class create mode 100644 src/Products/Product.java create mode 100644 src/Products/ProductTests.java create mode 100644 src/Questionaire/QuestionaireChecker.java create mode 100644 src/Questionaire/Student.java create mode 100644 src/Savings/SavingAccount.java create mode 100644 src/Savings/SavingForm.java create mode 100644 src/Student/Course.java create mode 100644 src/Student/Student.java create mode 100644 src/coffee/Batch.java create mode 100644 src/coffee/Coffee.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21b4487 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Project exclude paths +/out/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..07115cd --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..006830e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DeansBequest.iml b/DeansBequest.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/DeansBequest.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Emploice/Employees.java b/src/Emploice/Employees.java new file mode 100644 index 0000000..32762ab --- /dev/null +++ b/src/Emploice/Employees.java @@ -0,0 +1,26 @@ +package Emploice; + +public class Employees +{ + String lastName; + String firstName; + double hourlyWage; + int yearsWithCompany; + public Employees() + { + + } + public Employees(int years) + { + this.yearsWithCompany = years; + } + @Override + public String toString() + { + return "First Name: " + firstName + "\nLast name: " + lastName + "\nHourly wage: " + hourlyWage + "\nYears with company: " + yearsWithCompany; + } + public int getYears() + { + return yearsWithCompany; + } +} diff --git a/src/Emploice/Programs.java b/src/Emploice/Programs.java new file mode 100644 index 0000000..e6eb7f1 --- /dev/null +++ b/src/Emploice/Programs.java @@ -0,0 +1,24 @@ +package Emploice; + +import java.util.Random; + +public class Programs +{ + public static void main(String[] args) + { + Employees[] employs = new Employees[100]; + + for(int j = 0; j < employs.length; j++) + { + Random r = new Random(); + employs[j] = new Employees(r.nextInt(1,50)); + } + for(int i = 0; i < employs.length; i++) + { + if(employs[i].getYears() >= 20) + System.out.println(employs[i].toString()); + } + + + } +} \ No newline at end of file diff --git a/src/IceCreamMachineStuff/ChocolateIceCreamMachine.java b/src/IceCreamMachineStuff/ChocolateIceCreamMachine.java new file mode 100644 index 0000000..e1905cd --- /dev/null +++ b/src/IceCreamMachineStuff/ChocolateIceCreamMachine.java @@ -0,0 +1,45 @@ +package IceCreamMachineStuff; + +public class ChocolateIceCreamMachine extends IceCreamMachine +{ + private double Cocoa; + private double CocoaConsumption; + public ChocolateIceCreamMachine(double creamconsumption,double sugarconsumption, double cocoaconsumption) + { + this.CocoaConsumption = cocoaconsumption; + this.SugarConsumption = sugarconsumption; + this.CreamConsumption = creamconsumption; + } + + public void addMaterial(double cream,double sugar,double coca) + { + Cream += cream; + Sugar += sugar; + Cocoa += coca; + + } + + public double make(double amount) + { + double made = 0; + while(made < amount && Sugar >= SugarConsumption && Cream >= CreamConsumption && Cocoa >= CocoaConsumption) + { + made++; + Sugar -= SugarConsumption; + Cream -= CreamConsumption; + Cocoa -= CocoaConsumption; + + } + Icecream += made; + return made; + } + + @Override + public String toString() + { + return "No. of Cream: " + Cream + "\nNo. of IceCream: " + Icecream + "\n No. of sugar: " + Sugar + "\nNo. of Cocoa: " + Cocoa; + } + + + +} diff --git a/src/IceCreamMachineStuff/IceCreamMachine.java b/src/IceCreamMachineStuff/IceCreamMachine.java new file mode 100644 index 0000000..005373f --- /dev/null +++ b/src/IceCreamMachineStuff/IceCreamMachine.java @@ -0,0 +1,62 @@ +package IceCreamMachineStuff; + +public class IceCreamMachine +{ + double Cream; + double Sugar; + double Icecream; + double SugarConsumption; + double CreamConsumption; + IceCreamMachine() + { + + } + IceCreamMachine(double creamConsumption,double sugarConsumption) + { + this.CreamConsumption = creamConsumption; + this.SugarConsumption = sugarConsumption; + } + public void addMaterial(double cream,double sugar) + { + Sugar+=sugar; + Cream+=cream; + } + + public double howMuch() + { + double C = Cream; + double S = Sugar; + double amount = 0; + while(C >= CreamConsumption && S >= SugarConsumption) + { + + amount +=1; + C -= CreamConsumption; + S -= SugarConsumption; + } + return amount; + } + public double make(double amount) + { + double made = 0; + while(made < amount && Sugar >= SugarConsumption && Cream >= CreamConsumption) + { + made++; + Sugar -= SugarConsumption; + Cream -= CreamConsumption; + + } + Icecream += made; + return made; + } + public double pack() + { + double packs = Math.rint(Icecream); + return packs; + } + @Override + public String toString() + { + return "No. of Cream: " + Cream + "\nNo. of IceCream: " + Icecream + "\n No. of sugar: " + Sugar; + } +} diff --git a/src/IceCreamMachineStuff/MainProgram.java b/src/IceCreamMachineStuff/MainProgram.java new file mode 100644 index 0000000..7c1fa8a --- /dev/null +++ b/src/IceCreamMachineStuff/MainProgram.java @@ -0,0 +1,15 @@ +package IceCreamMachineStuff; + +public class MainProgram +{ + public static void main(String[] args) + { + ChocolateIceCreamMachine ChoccyGenerator = new ChocolateIceCreamMachine(10,5,3); + ChoccyGenerator.addMaterial(50,25,15); + ChoccyGenerator.make(4); + System.out.println("Amount in machine: " + ChoccyGenerator.pack()); + System.out.println(ChoccyGenerator.toString()); + + } + +} diff --git a/src/Products/Product.class b/src/Products/Product.class new file mode 100644 index 0000000000000000000000000000000000000000..480b8a4645aea6bf8955e8a635ddbc849f140bdb GIT binary patch literal 1222 zcma)6YflqF6g@**wyevm6tSRCl}Eb>#V5w9A8aL>)JFnh#81=h2uqjU&F+-IKk-NS zK@*V#6Muj|%6MmYqlFS|NR%Jg7C~8E zNhlbY#1!dmiVt2u;jz-$I_0e#b$!LaG-enk_IO*=JlEp#tu1%x6iV*OkYP2+>@HsK zA?p>$kgjp-F>eu zDsjQspEYhtFF0iQ*xg0~j7gtyx8;a%w&8j0j$iH7*cCaIxN+!gG$raOGL=i)bBk&aDMVI1cU=+G93F-u)NqGk zuE&Y<8q{!)Vfx=tn#I@+T%`f;qtQ#zqA90us4nO^3&j|*fo_@N8l*g(@)bh{*OKf8y~|LfcqZFiJR-)@5%OjseTr?8Dl26% z+ZginDPSBkq>O%D~nn-GxU!gC4!=+CYjD@K`6krNjT&Bnz=95&D$W==@ sN*SS*SE(li!skD^s(oOA= 1 && in <= 5) + { + ans[i] = in; + i++; + } else + System.out.println("invalid answer"); + + } + + } + +} diff --git a/src/Savings/SavingAccount.java b/src/Savings/SavingAccount.java new file mode 100644 index 0000000..2fe953f --- /dev/null +++ b/src/Savings/SavingAccount.java @@ -0,0 +1,39 @@ +package Savings; +public class SavingAccount +{ + static double interest_rate = 0.10; + + String id; + double amount; + SavingAccount(String Id,double Amount) + { + this.id = Id; + this.amount = Amount; + + } + + public double calc_profit() + { + double profit = amount * interest_rate; + amount+=profit; + return profit; + + } + public static double getInterest() + { + return interest_rate; + + } + + public double getAmount() + { + return amount; + } + + public static void setInterest_rate(double newInt) + { + interest_rate = newInt; + } + + +} diff --git a/src/Savings/SavingForm.java b/src/Savings/SavingForm.java new file mode 100644 index 0000000..300ec59 --- /dev/null +++ b/src/Savings/SavingForm.java @@ -0,0 +1,16 @@ +package Savings; +public class SavingForm +{ + public static void main(String[] args) + { + SavingAccount a1 = new SavingAccount("123asjkljr",500); + + System.out.println("Balance is : "+ a1.getAmount() + " BEFORE profit"); + + double a1profit = a1.calc_profit(); + + System.out.println("Profit is : "+a1profit); + System.out.println("Balance is : "+a1.getAmount()); + + } +} diff --git a/src/Student/Course.java b/src/Student/Course.java new file mode 100644 index 0000000..92f9921 --- /dev/null +++ b/src/Student/Course.java @@ -0,0 +1,41 @@ +package Student; + +public class Course { + private String title; + private int Students; + private final int maxStudents = 10; + Student[] students = new Student[10]; + int count = 0; + + public String Register(Student student) { + if (count < 10) { + students[count] = student; + count++; + return "Success"; + } else { + return "Course full!"; + } + + } + public boolean isFull() + { + if(count ==9) + return true; + else + return false; + } + + public int NumberofStudents() + { + if(students[0].getName().isBlank()) + return 0; + else + return count; + + } + public String title() + { + return title; + } + +} diff --git a/src/Student/Student.java b/src/Student/Student.java new file mode 100644 index 0000000..740745f --- /dev/null +++ b/src/Student/Student.java @@ -0,0 +1,30 @@ +package Student; + +public class Student +{ + private String name; + private String id; + + Student(String n, String Id) + { + this.name=n; + this.id=Id; + } + + public String getName() + { + return name; + } + + public String getId() + { + return id; + } + + public void Register(Course course) + { + //To be done later + } + + +} diff --git a/src/coffee/Batch.java b/src/coffee/Batch.java new file mode 100644 index 0000000..8be51fd --- /dev/null +++ b/src/coffee/Batch.java @@ -0,0 +1,43 @@ +package coffee; + +public class Batch +{ + int amount; + double price; + + + public int addBatch(int Takenout) + { + + if(Takenout >= amount) + return amount; + if(amount == 0) + return 0; + amount-=Takenout; + return Takenout; + } +//ge4ta + + public int getAmount() + { + return amount; + } + + + public int available() + { + return amount; + } + + + + + @Override + public String toString() + { + return "Amount in batch: " + amount + "\nTotal Price: " + price; + } + + + +} diff --git a/src/coffee/Coffee.java b/src/coffee/Coffee.java new file mode 100644 index 0000000..1b42780 --- /dev/null +++ b/src/coffee/Coffee.java @@ -0,0 +1,48 @@ +package coffee; + +import java.util.Date; +import java.util.Stack; + +public class Coffee extends Batch { + String name; + double price; + int stock; + Stack sold_records = new Stack(); + + Coffee() { + + } + + Coffee(String n, double p, int s) { + this.name = n; + this.price = p; + this.stock = s; + } + + public void changePrice(double newprice) { + price = newprice; + } + + public void prepare(int num) { + stock += num; + } + + public void addStock(Batch batch,int amt) + { + prepare(batch.addBatch(amt)); + } + + public void sell(int num) + { + stock-=num; + sold_records.push(new Date()); + } + + + @Override + public String toString() + { + return "Name: " + name + "\nPrice: " + price + "\nStock: "+ stock; + } + +} \ No newline at end of file