Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can anyone help please espially last three questions AE Remaining Time: 59 minutes, 49 seconds. *Question Completion Status: What are the values of c1.x and

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
can anyone help please espially last three questions
AE Remaining Time: 59 minutes, 49 seconds. *Question Completion Status: What are the values of c1.x and 2x after executing the following code? public class MyClass public int x; public MyClass(int x){this.x = x;) public MyClass(MyClass o this.x-ox) public void setX(int x this.x=x) }llend of class MyClass public class Tester public static void main(String[] args) { MyClass c1 - new MyClass(10): MyClass C2 - new MyClass(11); d-new MyClass(c2): 2 set5) } llend of class Tester c1.x - 11 and 2x-5 1.X-5 and c2x-5 cix= 10 and (2x-11 ctx-10 and 2.X-5 as Remaining Time: 56 minutes, 37 seconds. Question Completion Status: What is the output of the following code? public class MyClass int x=0; public MyClass(ints)[x=s; } public void setX(int s}(x=s; } public int getX({ return x;} }llend of class MyClass public class Test public static void main(String[] args) MyClass c= new MyClass(); C.SetX(S) System.out.println(c-getX() + 5); > Hllend of class Test Error 5 10 Remaining Time: 56 minutes, 17 seconds. * Question Completion Status: Given the following Time class, what is the output of the Tester class? public class Time private int hr, min; public Time(int hr, int min) this.hr-hr; this.min-min; 3 public int getHro{ return hr; } Ylend of class Time public class Tester public static void main(String[] ar} Time t1 = new Timel 9,5), Time t2t1; t1=null; System.out.print(12 getHrol: > llend of class Tester Blackboard X Remaining Time: 56 minutes, 01 second. Question Completion Status: Glven the class MyClass below, what is the output of the Test class? public class MyClass public int x = 0; public MyClass(int xX this.x = x 3 public MyClass change(int x){ this.x=x; return this; ) Y/end of class MyClass public class Test: public static void main(String a MyClass c1 - new MyClass(1); MyClass c2-c1.change(2); System.out.println( c1.x+""+c2.x): llend of class Test Blackboard Remaining Time: 55 minutes, 47 seconds. Question Completion Status: A Moving to another question will save this response. Question 5 Given the following two classes MyClass and YourClass, which variables can be used in the blank at line 117 1. public class MyClass { 2. private int x 3. public inty: 4. Ylend of class MyClass 5. 6. public class YourClass 7. private int x 8. public inty: 9. public void food 10. MyClass cnew MyClass: 11. int temp. 12. > 13. Ylend of class YourClass only: x,y,cx.cy O only: x, y only y,cy only: x,y,cy another question will save this response. 2 Blackboard DI Remaining Time: 55 minutes, 33 seconds. Question Completion Status: What is the output of the following code? public class MyClass int x = 0; public MyClass(int s) (x=s) public void setX(int s x=S;} public int getX(){ return x;) plend of class MyClass public class Test public static void main(String[] args) MyClass c= new MyClass(5); C.set(c.get()*2): System.out.printlntc getX()); } Ylend of class Test 10 Error 0 ckboard Remaining Time: 55 minutes, 19 seconds. Question Completion Status: Question 7 What will be the output of the the following code: public class MyClasst private int x public static inty=0; public MyClass(int ax Xa: void set/fint ay **a;} Ylend class MyClass public class Test public static void main(String[] a) MyClass ct = new MyClass(3): MyClass C2 - new MyClass(5); c1.y = 7; c2.y++) System.out.print(ct. y + ,*+ c2.9k }//end of class Test Question 8 Glven the following UML diagrams for the classes Patient and Doctor, and assuming the classes are already Implemented, we following - [1 marks] Create object(s) for the following Patient Patient Name: All Hassan, patientID: 3344, age: 60 . [1 marks) Define an array of 20 Doctors, call the array doctors List [2 marks) Assume that the array is populated with 26 doctors, write a code to find the number of doctors who are surgeon Patient Doctor doctoriD:String patientid:int patientName:String Fage:int Patient(int String,int) W+ Getters and Setters name:String -speciality String Doctor(String String Stringi VI+Getter and Setters +Group OfAge():String toString():String HisSurgeon (): boolean toString():String T+F10 (PC) or ALT+FN+F10 (Mac). w if (gander --N) { publie Waltint calories, boolechy limit -1500 this.colories - calories > else if (gender --) > public int gutcalories) meals - new Meal[num) return calories ) } public void add(Meal m) { publie boolean islealthy) int i = 0; return healthy while (i else { meals[i].my return "You ate + calorien 3 + " calories of unhealthy food"; 3 total +- m.getCalories(); > public void printPlan() { int i = 0; while (i smeals.length & meals[1] != null){ System.out.println(meals[i].toString()); public class Main { + public static void main(String[] args) { it total > linit) MealPlan myPlan - new MealPlan('I', 4); myPlan.add(new Meal(200, true); System.out.println("Tatal is + total myPlan.add(new Meal(200, false): + exceeding your limit"); myPlan.add(new Meal(300, true)) else myPlan.add(new Meal()); System.out.println("Total is + total myPlan.printPlant): + within your limit"); Click Submit to complete this assessment. Question 10 Write the Java code for the class Patient based on the UML below and considering the following . [1 marks] Declare all member variables as in the UML diagram of the dass Patient. . [1 mark] Write the constructor which takes 3 parameters to set the variables of the class Patient [1 mark] Write a setter and a getter for the member variable age. . // Assume that the other setters and getters are implemented (Don't write them), and you can use them in other cases . (1.5 mark] Write The method Group OfAge that returns a string saying whether the patient is Senior or Not Seniorgiven that the patients are si year-old. . (1.5 mark] Write the toString method which should return a string with patienti, patientName, and whether the patient la Senior on net. I shall be The patient Ali Al Hammadi, ID: 7747 is Not Senior Patient patientid:int patientName:String Page:int Patient(int String,int) VA+ Getters and Setters H+GroupOfAge0:String AtoString(:String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago