diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fe1f5c..ebf5ffb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,9 +18,9 @@ "files.autoSave": "afterDelay", "screencastMode.onlyKeyboardShortcuts": true, "terminal.integrated.fontSize": 18, - "workbench.activityBar.visible": true, "workbench.colorTheme": "Visual Studio Dark", "workbench.fontAliasing": "antialiased", "workbench.statusBar.visible": true, - "java.server.launchMode": "Standard" -} + "java.server.launchMode": "Standard", + "java.debug.settings.onBuildFailureProceed": true +} \ No newline at end of file diff --git a/_01_02b/Employee.java b/_01_02b/Employee.java index 12928d5..ab028af 100644 --- a/_01_02b/Employee.java +++ b/_01_02b/Employee.java @@ -5,33 +5,33 @@ public class Employee { public static void main(String[] args) { // Create a variable called age of type int and assign it the value 29. - + int age = 29; // Print the age variable to the console. - + System.out.println(age); // Create a variable called isAManager of type boolean and assign it the value // true. - + boolean isAManager = true; // Print the isAManager variable to the console. - +System.out.println(isAManager); // Create a variable called yearsOfService of type double and assign it the // value 2.5. - + double yearsOfService = 2.5; // Print the yearsOfService variable to the console. - +System.out.println(yearsOfService); // Create a variable called baseSalary of type int and assign it the value 3000. - +int baseSalary = 3000; // Create a variable called overtimePayment of type int and assign it the value // 40. - +int overtimePayment = 40; // Create a variable called totalPayment of type int and assign it to the value // of baseSalary added to overtimePayment. - +int totalPayment = baseSalary + overtimePayment; // Print the totalPayment variable to the console. - +System.out.println(totalPayment); // Create three variables all of type double on a single line. // They should be called firstBonus, secondBonus and thirdBonus and they should // be assigned the values 10.00, 22.00 and 35.00. - +//double firstBonus, secondBonus, thirdBonus = 10.00, 22.00, 35.00; // Print out the sum of the variables called firstBonus, secondBonus and // thirdBonus. diff --git a/_01_04/MenuBuilder.java b/_01_04/MenuBuilder.java index aeaebc5..e5792d6 100644 --- a/_01_04/MenuBuilder.java +++ b/_01_04/MenuBuilder.java @@ -7,26 +7,27 @@ public static void main(String[] args) { // Create a variable called menuTitle of type String and assign it the value "My // Dream Menu:". - +String menuTitle = "My Dream Menu"; // Print the menuTitle variable to the console. - +System.out.println(menuTitle); // Create a variable called menu of type ArrayList. - +ArrayList menu = new ArrayList<>(); // Create a variable called starter of type MenuItem and pass in the name of // your favourite starter. - +MenuItem starter = new MenuItem("Calmari"); // Add the starter variable to the ArrayList called menu. - +menu.add(starter); // Create a variable called mainCourse of type MenuItem and pass in the name of // your favourite main course. - +MenuItem mainCourse = new MenuItem("Lasagne"); // Add the mainCourse variable to the ArrayList called menu. - +menu.add(mainCourse); // Create a variable called dessert of type MenuItem and pass in the name of // your favourite dessert. - +MenuItem dessert = new MenuItem( "Toffee shit"); // Add the dessert variable to the ArrayList called menu. - +menu.add(dessert); // Print the menu variable to the console. + System.out.print(menu); } -} +} \ No newline at end of file diff --git a/_01_05b/MenuBuilder.java b/_01_05b/MenuBuilder.java index cc35ba3..edf1637 100644 --- a/_01_05b/MenuBuilder.java +++ b/_01_05b/MenuBuilder.java @@ -1,6 +1,6 @@ package _01_05b; -import java.util.ArrayList; +//import java.util.ArrayList; public class MenuBuilder { public static void main(String[] args) { diff --git a/_02_02/Instructions.md b/_02_02/Instructions.md index 69cbb27..039993e 100644 --- a/_02_02/Instructions.md +++ b/_02_02/Instructions.md @@ -1,4 +1,5 @@ 1. Create a class called Ticket + 2. Give the class an empty constructor 3. Create 3 private field variables in the class: - A field of type String called destination diff --git a/_02_03b/Ticket.java b/_02_03b/Ticket.java new file mode 100644 index 0000000..1ec8fca --- /dev/null +++ b/_02_03b/Ticket.java @@ -0,0 +1,10 @@ +package _02_03b; + +public class Ticket { + + public Ticket() {} + + private String destination; + private double price; + private boolean isReturn; +} diff --git a/_02_05b/Ticket.java b/_02_05b/Ticket.java index 339f8a0..2b743e9 100644 --- a/_02_05b/Ticket.java +++ b/_02_05b/Ticket.java @@ -12,8 +12,29 @@ public Ticket() { // Add three public methods to set the value of each field, called // setDestination, setPrice and setIsReturn. +public void setDestination(String destination) { + this.destination = destination; +} + +public void setPrice(double price) { + this.price = price; + + +} +public void setIsReturn(boolean isReturn) { + this.isReturn = isReturn; +} // Add three public methods to get the value of each field, called // getDestination, getPrice and getIsReturn. + public String getDestination() { + return destination; + } + public double getPrice() { + return price; + } + public boolean getIsReturn() { + return isReturn; + } } diff --git a/_03_03b/GradingSystem.java b/_03_03b/GradingSystem.java index c8717c7..23dd435 100644 --- a/_03_03b/GradingSystem.java +++ b/_03_03b/GradingSystem.java @@ -5,7 +5,12 @@ public class GradingSystem { public boolean isAPass(int percentage) { // Return true if the percentage is higher than or equal to 60. // Otherwise return false. - return false; + if (percentage >= 60) { + return true; + } else { + return false; + } + } public char getGrade(int percentage) { @@ -14,8 +19,19 @@ public char getGrade(int percentage) { // If it's 70-79, return 'C'. // If it's 60-69, return 'D'. // If it's less than 60, return 'F'. - return 'X'; - } + if (percentage >= 90) { + return 'A'; + } else if(percentage >=80) { + return 'B'; + } else if(percentage >=70){ + return 'C'; + } else if(percentage >=60) { + return 'D'; + } else { + return 'F'; + } + } + public String retakeMessage(int percentage, boolean allowedToRetake) { // If percentage is less than 60 and allowedToRetake is true, return a String @@ -24,7 +40,16 @@ public String retakeMessage(int percentage, boolean allowedToRetake) { // that says "The student is not allowed to retake this exam." // If percentage is 60 or higher, return a String that says "A retake is not // required." - return ""; + if(percentage < 60 && allowedToRetake == true) { + return "The student has been entered for a retake."; + } + else if (percentage <60 && !allowedToRetake) { + return "Can not retake"; + } + else { + return "A retake is not required"; + } + } }