Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just have to write how the code interest you the most and just describe in few lines. write something about the picture shown the diagram.

image text in transcribed

image text in transcribed

Just have to write how the code interest you the most and just describe in few lines.

write something about the picture shown the diagram.

Class Design Guidelines Object-oriented Design and Programming: UML and Java Designing an object-oriented program requires 5 steps: 00 Design and Programming in Java Identify the classes Determine the relationships between classes Determine the roles of each class (what each class is responsible for) Determine the attributes of each class Identify classes needed Write an application applet class Write an class e Determine superclasses Ruse Reuse Design Create and use objects and subclasses API your new Refine object design classes classes classes On page 531, "Class Design Guidelines" summarizes some of the guidelines of designing Java classes. What interests you most? 13.10 Class-Design Guidelines 531 tional r2 now Rational (1, 123456789) 1 r3now Rational(1, 123456789): rt.nultiply (r2.multiply(r3))): r2 r3 151/2204193661661244627 rt To fis it, you can implement the ational class using the BigInteger for numerator and denominator (see Programming Exercise 13.15). 13.9. Show the output of the following code: heck Point Rational r1new Rational (-2, 6): System.out printin (r1.getNumeratorO) System.out.println (r1.getDenominator (): System.out.println (r1.intValue()): System.out printin r.doubleValue)) 13.9.2 Why is the following code wrong? Rational rinew Rational (-2. 6) Object r2 now Rational (1, 45); System.out.printin (r2.compareTo (r1)) 13.9.3 Why is the following code wrong? object r1now Rational (-2, 6) Rational r2 new Rational (1, 45); Systen.out.println(r2.compareTo(r1)): 13.9.4 Simplify the code in lines 82-85 in Listing 13.13 Rational java using one line of code without using the if statement. Simply the code in lines 110-115 using a conditional operator. 13.9.5 Trace the program carefully and show the output of the following code: Rational r new Rational (1, 2) Rational r2 new Rational (1, -2): System.out.println(r1.add(r2)) The preceding question shows a bug in the toString method. Revise the toString) method to fix the error 13. 9.6 13.10 Class-Design Guidelines Class-desi design guidelines are helpful for designing sound classes ve learned how to design classes from the preceding example and from many other in the previous chapters. This section summarizes some of the guidelines. 13.10.1 Cohesion should describe a single entity, and all the class operations should logically fit together to coberens purpose epport a coherent bine students ent purpose. You can use a class for students, for example, but you should not com- ts and staff in the same class, because students and staff are different entities

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

Students also viewed these Databases questions

Question

all MetroPCS 4:31 AM 50%

Answered: 1 week ago

Question

What best describes a nested IF statement?

Answered: 1 week ago