Answered step by step
Verified Expert Solution
Question
1 Approved Answer
File Link - https://www.dropbox.com/s/ij89yxj0op7ciix/Hw5ClassExample.zip?dl=0 You will essentially be converting C++ code to Java. Please note that for this the C++ code would have to be
File Link - https://www.dropbox.com/s/ij89yxj0op7ciix/Hw5ClassExample.zip?dl=0
You will essentially be converting C++ code to Java. Please note that for this the C++ code would have to be modified slightly as Java doesn't use pointers.
Question) Write a JAVA CODE that takes the classes given in C++ (in the file attached) as classes in Java, including the point, the triangle, the rectangle class, and the square class. Once you're done paste the code here as answer to the prob with a screenshot of the output
Classes and Java In this homework, you will build on your knowledge of classes, Inheritance and Polymorphism, and introduce the ideas of programming in Java. Problem: You are asked to implement a number of classes that inherit from a base class in Java given a working example in C++. The base class is shape and it contains an item of the point class as well as a number of virtual functions. You will derive from this shape a rectangle class. From the rectangle you will derive a square class. You will explore the ways that Java handles classes and how it is similar to and distinct from C++ Requirements: You are required to implement the classes given in the C++ as classes in Java, including the point class, the triangle class, the rectangle class, and the square class. The main intention of this exercise is to practice the concepts that we have learned around classes and make the conceptual connection between classes in C++ and Java. NOTE: This will require some minor changes to the code, as Java does not use pointers! The intention is to learn the syntax around classes in Java and how objects are created
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started