Create a driver program that defines a circle object

Assignment Help JAVA Programming
Reference no: EM132098978

Please Note: This program is in C++

and also, create the header file, implementation and driver file seperately

Problem Statement
Define a pure abstract base class called BasicShape. The BasicShape class should have the following members:

Private Member Variable:

area, a double used to hold the shape's area.

Public Member Functions:

getArea. This function should return the value in the member variable area.

calcArea. This function should be a pure virtual function.`

Next, define a class named Circle. It shoudl be derived from the BasicShape class. It should have the following members:

Private Member Variables:

centerX, a long integer used to hold the x coordinate of the circle's center.

centerY, a long integer used to hold the y coordinate of the circle's center.

radius, a double used to hold the circle's radius

Public Member Functions

constructor - accepts vaues for centerX, centerY, and radius. Should call the overridden calcArea function described below.

getCenterX - returns the value of centerX.

getCenterY - returns the value of centerY.

calcArea - calculates the area of the circle (area = 3.14159 * radius * radius) and stores the result in the inherited member area.

Next, define a class named Rectangle. It should be derived from the BasicShape class. It should be derived from teh BasicShape class. It should have teh following members:

Private Member Variables

width, a long integer used to hold the width of the rectangle.

length, a long integer used to hold the length of the rectangle.

Public Member Functions:

constructor - accepts values for width and length. Should call teh overridden calcArea function described below.

getWidth - return the value in width.

getLength - returns the value in length.

calcArea - calculates teh area of teh rectangle (area = length * width) and stores the result in the inherited member area.

After you have created these classes, create a driver program that defines a Circle object and a Rectangle object. Demonstrate that each object properly calculates and reports its area.

Reference no: EM132098978

Questions Cloud

What is an adt stack : Test it by creating a DRIVER/Test file with int main, and Test the stack class and its basic functionality.
Method-string values in reverse order : Write_a method that will accept as input three string values from a user. The method will return to the user a concatenation of the string values in reverse
Draw new average and marginal revenue curves : BUECO5903 BUSINESS ECONOMICS ASSIGNMENT, FEDERATION UNIVERSITY BUSINESS SCHOOL, Australia. Draw new average and marginal revenue curves
Describes the application you choose and the class : Describes the application you choose and the class within that application. Identify one or two key distinctions within that class that would prompt
Create a driver program that defines a circle object : Create a driver program that defines a Circle object and a Rectangle object. Demonstrate that each object properly calculates and reports its area.
Define a two-dimension array with 10 rows : 1. Define a two-dimension array with 10 rows and 2 columns.
Create a gui application that allows the user to select rate : Create a GUI application that allows the user to select a rate category, and enters the number of minutes of a call into a text field.
Predefined function-method : In Java, you have the opportunity either to use a predefined function/method or to writea user-defined function/method.
Design an advanced circular shifter : Design an advanced circular shifter that the shifter is able to shift right directly by multiple bits.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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