Use the testcircle.java program to test your classes

Assignment Help JAVA Programming
Reference no: EM13941308

Using the attached files modify the code to use inheritance, an interface, and aggregation by completing the following steps:

1. In the Shape class, eliminate the concrete methods, area() and perimeter(); create an instance variable of type String called name; and make a constructor that requires a String, shapeName, as the name of the new Shape object. Keep the method getLocation(), and keep the Shape class abstract.

2. Create an interface, Shape2D, which will require the methods, area() and perimeter(), which were elimated from Shape.

3. Create a new class, Point, which inherits from Shape and contains two private instance variables of type int, x and y, which store the coordinates for the Point. Point should have both a default constructor and a constructor that takes two int values for the coordinates x and y. For the default constructor, set both x and y to zero.

4. Modify the class, Circle, to inherit from Shape as well as use the interface, Shape2D. Circle should have only two private instance variables: a double named, radius, and a Point object reference named, center. Circle should have two constructors, a default constructor and a constructor that takes a double as a new radius value and two ints as the x and y coordinates of the center. Circle does not store the x and y values as ints, but instead creates a Point object with these coordinates. The location of a Circle is the location of its center, Point.

5. Use the TestCircle.java program to test your classes until they are error-free .

Attached files:

TestCircle.java
Circle.java
Shape.java

Attachment:- Circle.zip

Reference no: EM13941308

Questions Cloud

What are some of the contributions of the renaissance popes : What are some of the contributions of the "Renaissance Popes"? How did they affect the culture and geography of their time? How did their activities eventually lead to the Protestant reformation?
Tax avoidance as an ethical issue for business : Read the business ethics briefing, Tax Avoidance as an Ethical Issue for Business and answer all parts of the question below. The total word limit is 850.
Why was rome able to maintain an empire : Why was Rome able to maintain an empire that came to dominate the Mediterranean world, whereas the empires that rose in Egypt and Mesopotamia who had more stable and streamlined governments failed to rise to such strength? Be specific in your use ..
Size and extent of conceptual studies : Literature Review comprises the following typical tasks: Conduct a team brainstorming session to scope, the size and extent of conceptual studies needed and agree on strategies to complete the same on time.
Use the testcircle.java program to test your classes : Create a new class, Point, which inherits from Shape and contains two private instance variables of type int, x and y, which store the coordinates for the Point
Nat/pat helped address the ipv4 address : Compare MAC with IPv4 addresses providing an example of each, how those addresses are assigned and what role they play in the operation of a network.
Challenges that the company as well as the government faces : Identify possible constraints and problems that may hinder effective decision making. Explore and discuss the possible constraints or challenges that the company as well as the government faces,
Career development plan and commentary : A personal career development plan and commentary on the challenges you will face in undertaking it.
Most fundamental concepts in the culture : Do you agree with the notion suggested by Lakoff and Johnson that 'the most fundamental values in a culture will be coherent with the metaphorical structure of the most fundamental concepts in the culture'? Illustrate with your own examples where ..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write an array where the user can input 7 temperatures

Write an array where the user can input 7 temperatures; include a 'for' loop. Make sure the temperatures are larger than -100 and smaller than or equal to 120, if not, make sure the user enters a valid number. Make sure the temperature is between the..

  Inheritancedemo

Create a New Project named InheritanceDemo . 2. Create a new class called Person and cut and paste the Person.java file from Blackboard into the class. Create a new class called Student and cut and paste the Student.java file from Blackboard into the..

  Calculate the premium and multiply the value of the object

Implement all the four Java classes described with the correct inheritance of abstract classes. Calculate the premium and multiply the value of the object being insured by the corresponding RATE. See the RATE tables above.

  Calculate your age in the year 2060.

Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the currentYear. Use four digits for year. Use four digits for the year.

  Design a solution to the problem by using the five steps to

the software needs to allow the restaurant owner to schedule employees for up to 40 hours in a seven-day week. the

  Create file using any word-processing program or text editor

Create a file using any word-processing program or text editor. Write an application that displays the file's name, containing folder, size, and time of last modification. Save the file as FileStatistics.java.

  A method with the signature public static void

A method with the signature public static void printDetails(City[] cities) that will iterate through the cities and printthe details of the city using the displayDetails(...) method.

  Dijikstra for undirected graph using simple scheme with

dijikstra for undirected graph using simple scheme with array and fibonacci heap and compare the performanceresults

  Create an array of date objects

Create an array of Date objects of size 4. Initialize the array by using a loop. In the loop, use the Scanner.nextLine() method to input a date as a string, convert it to a date by using the toDate() method, and assign the result to an element in ..

  Write a program that prompts the user for a start date

You need to write a program that prompts the user for a start date and an end date and then prints all of the dates between them (inclusive), with seven tab-separated dates on each line.

  Can linear search algorithm be encoded using recursion

Determine the average amount of time people spend waiting for tables and provide examples from the "real world" of unsorted lists, sorted lists, indexed lists, lists that permit duplicate elements, and lists that do not permit duplicate elements

  Program to calculate semester grade based on the scores

Write a java application program that takes in user input from keyboard and calculate semester grade based on the scores. I need help, to rewrite the program, instead of taking keyboard input, you will use dialog box to prompt user, take input, an..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd