Java Work do this before attempting Java exercises (or after you get stuck!) – Make sure you have completed sections 1-4 of this booklet. Go to chortle site or use mirror site . Go through chapters 8 11 and do as many exercises and – quizzes as you need. Set aside at least six hours to work through these chapters and more if you do more than a few of the exercises. After chapters 8 9c attempt question 1 below (filling in – answers 01 to 03). After chapters 10 11 attempt question 2, 3 and 4 below (filling in answers – 04 to 11). Useful links to go with chortle reading above and help with exercises to follow below: Basic BlueJ program Use of Scanner Bucky tutorials (use Eclipse IDE instead of BlueJ but otherwise are relevant) Java Programming Tutorial - 6 - Getting User Input (OR on the new boston: etc) Java Programming Tutorial - 7 - Building a Basic Calculator StBrendan (use BlueJ Scanner with integer division and remainder useful for que 2) Code academy learn Java (units 1 and 2 free stuff only also try code in BlueJ) – – – Type your answers to the exercises below in your Electronic Answer Document. You must save this document at regular intervals. Question 1 Create a class Exercise1 with the code below (you can type in or copy and paste): public class Exercise1 { public static void main (String[] args) { double km = 30, miles miles = km * 5 / 8; System.println(km + " kilometres is " + miles + " miles"); }//end main }//end class (a) The program has two compilation errors. Correct these. What you need to do Modify the program so that it so the program compiles and runs (tip: see EAD front sheet for help on pasting screenshots into EAD) (b) (i) replace by compile and run miles = km * 5 / 8; miles = 5.0 / 8 * km; (ii) replace by compile and run miles = 5.0 / 8 * km; miles = 5 / 8 * km; Explain fully the results obtained in running versions b(i) and (ii). To gain full (2 marks you will need to note the relevance of data types (Chortle chp 8, 9B) marks)
Java Work – do this before attempting Java exercises (or after you get stuck!) Make sure you have completed sections 1-4 of this booklet. Go to chortle site or use mirror site . Go through chapters 8 – 11 and do as many exercises and quizzes as you need. Set aside at least six hours to work through these chapters and more if you do more than a few of the exercises. After chapters 8 – 9c attempt question 1 below (filling in answers 01 to 03). After chapters 10 – 11 attempt question 2, 3 and 4 below (filling in answers 04 to 11). Useful links to go with chortle reading above and help with exercises to follow below: Basic BlueJ program Use of Scanner Bucky tutorials (use Eclipse IDE instead of BlueJ but otherwise are relevant) Java Programming Tutorial - 6 - Getting User Input (OR on the new boston: etc) Java Programming Tutorial - 7 - Building a Basic Calculator StBrendan (use BlueJ Scanner with integer division and remainder useful for que 2) Code academy – learn Java (units 1 and 2 – free stuff only – also try code in BlueJ) Type your answers to the exercises below in your Electronic Answer Document. You must save this document at regular intervals. Question 1 Create a class Exercise1 with the code below (you can type in or copy and paste): public class Exercise1 { public static void main (String[] args) { double km = 30, miles miles = km * 5 / 8; System.println(km + " kilometres is " + miles + " miles"); }//end main }//end class (a) The program has two compilation errors. Correct these. What you need to do Modify the program so that it so the program compiles and runs (tip: see EAD front sheet for help on pasting screenshots into EAD) (b) (i) replace miles = km * 5 / 8; by miles = 5.0 / 8 * km; compile and run (ii) replace miles = 5.0 / 8 * km; by miles = 5 / 8 * km; compile and run Explain fully the results obtained in running versions b(i) and (ii). To gain full marks you will need to note the relevance of data types (Chortle chp 8, 9B) (2 marks)
Summer_task_2017.docx