Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction to Java for C + + Programmers JAC 4 4 4 Please read the following guidelines very carefully before answering any questions: You will

Introduction to Java for C++ Programmers
JAC 444
Please read the following guidelines very carefully before
answering any questions:
You will at least define a class with the main method for each question.
You must keep the class name requested in each question.
You must hold the naming conventions requested in this document
and each question.
All deliverables are defined at the end of this document. You must
upload them as requested.
1.(Class Name: MyInteger, Java File Name: MyInteger.java)
Design and write a class named MyInteger. The class contains:
An int data field named value that stores the int value represented
by this object.
You must encapsulate data.
A no-arg constructor that creates a default MyInteger object.
A constructor that creates a MyInteger object for the specified int value.
MyInteger (int newValue){dots}
A getter method that returns the int value
The methods isEven() and isOdd() that return true if the value in this object is even or odd.
The static methods isEven(int) and isOdd(int), which return true if the
specified value is even or odd.
The static methods isEven(MyInteger) and isOdd(MyInteger), which return
true if the specified value is even or odd.
The methods equals(int) and equals(MyInteger) that return true if the value in this object is equal to the specified value.
In the main method, write a testing program that tests all methods in the class. [50 Points]
2.(Class Name: Triangle, Java File Name: Triangle.java)
Design and implement a class named Triangle that extends GeometricShape (See the sample codes for this class). The class contains:
Three double data fields named side1, side2, and side3 with default values
3.0,4.0, and 5.0 denote three sides of a triangle.
You must encapsulate data.
A no-arg constructor that creates a default triangle.
A constructor that creates a triangle with the specified side1, side2, and side3.
The accessor methods for all three data fields.
A method named getPerimeter() that returns the perimeter of this triangle.
Perimeter: p= side 1+ side 2+ side 3
A method named getArea(that returns the area of this triangle.
Area: ,a=\sqrt(((p)/(2))((p)/(2)-side1)((p)/(2)-side2)((p)/(2)-side3))
Square Root method in Java: Math.sqrt()
A method named toString() that returns a string description for the triangle.
For example, if we have a triangle with the following sides (3.0,4.0,5.0), the toString() method must return:
Triangle: side 1=3.0, side 2=4.0, and side 3=5.0
In the main method, write a testing program that prompts the user to enter three sides
of the triangle, a colour, and a Boolean value to indicate whether the triangle is filled.
The program should create a Triangle object with these sides and set the colour and
filled properties using the input. The program should display the area, perimeter,
colour, and true or false to indicate whether it is filled or not. [50 Points]
Deliverables:
A) Create an up to 15-minute video (only ONE video for all the questions)
explaining your answers, upload it on YouTube, and submit the link of your
video on Blackboard.
See "How to make a video and upload it on YouTube?" under the "Course
Information" on Blackboard.
Your video must at least contain the following content:
a. Explaining the kev components of your code and how thev work.
b. Showing three different runs and outputs of your code for each
question.
Note: There is no mark if you just read your code. You must explain your code, not read it.
Note: Please DO NOT upload the original video file on Blackboard.
B) You must upload all requested Java files (i.e."*.java") as they are.

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

What is IKE? What is its role in IPSec?

Answered: 1 week ago

Question

What are the three most common sources of equity funding?

Answered: 1 week ago