ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 11 Weeks Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 29 May 2017 My Price 9.00

Write a program that first prompts users for five real numbers as XB, XC, YC, XD, YD

Assignment Instruction

  • Write a program that first prompts users for five real numbers as XB, XC, YC, XD, YD. Note that, with these five real numbers, the shape ABCD is determined.
  • [Task 1] Your first task is to display the accurate type of Shape ABCD on the screen (such as Quadrilateral, Trapezoid, Parallelogram, Rectangle or Square)
  • [Task 2] If Shape ABCD is Trapezoid, Parallelogram, Rectangle or Square, your second task is to calculate its area and display the result on screen.
  • [Programing Requirement] Your program MUST have an inheritance hierarchy of five classes: Quadrilateral, Trapezoid, Parallelogram, Rectangle and Square. Each and every one of these five classes MUST have a method called Area(), which calculates the area of the shape. You can choose how to design the rest of the program.
    • Make your app as user friendly as possible (e.g., easy-to-follow user instruction; clearly presented result; meaningful error messages; etc).
    • Annotate your program with comments properly so that others can easily follow your logic.

Mathematical CheatSheet:

  • Mathematical hints to solve the problem (Check their accuracy!)
    • if YC = YD, then Shape ABCD is at least a trapezoid
    • if YC = YD and (XC-XD)= XB , then Shape ABCD is at least a parallelogram
    • if YC = YD and (XC-XD)= XB and XD, then Shape ABCD is at least a rectangle
    • if YC = YD and (XC-XD)= XB and XD and XC= Yc, then Shape ABCD is a square
  • How to calculate the areas of different shapes:

 

[Hint] Here is one possible design, but you don’t have to follow it. You are encouraged to come up with your own.

  • Design a class Quadrilateral as the base class, then Trapezoid as a derived class of Quadrilateral; Parallelogram derived from Trapezoid; Rectangle derived from Parallelogram; and Square derived from Rectangle.
    • Make XB, XC, YC, XD, YD as attributes of class Quadrilateral, and then they are inherited by the derived classes.
    • Class Quadrilateral has a method, Area(), which needs to be overridden by all its derived classes. Each derived class has its own way of calculating the area based on the values of XB, XC, YC, XD, YD
    • Write a static method, inspectShapes(), for Quadrilateral, which takes the inputs of five real numbers as XB, XC, YC, XD, YD as parameters and then tell exactly what a shape ABCD is.

 ATTACHMENT PREVIEW Download attachment

Kui Du, Fall 20151Assignment InstructionConsidering the following quadrilateral (i.e., a shape with four sides) in a Cartesian coordinate plane (x-y plane):The shape consists of four points A, B, C, and D, whose x-y coordinates are shown as in the figure. For mathematicalsimplicy, we assume that following: (1) Point A is fixed in the origin (0,0); (2) Point B is fixed on the x-axis; (3) Point C,and D are fixed in quadrant I; and (4) Point C is to the right of Point DRequirements:ï‚·Write a program that first prompts users for five real numbers as XB, XC, YC, XD, YD. Note that, with these five realnumbers, the shape ABCD is determined.ï‚·[Task 1]Your first task is to display the accurate type of Shape ABCD on the screen (such asQuadrilateral,Trapezoid,Parallelogram,RectangleorSquare)ï‚·[Task 2]If Shape ABCD isTrapezoid,Parallelogram,RectangleorSquare,your second taskisto calculate its areaand display the result on screen.ï‚·[Programing Requirement]Your programMUSThave an inheritance hierarchy of five classes:Quadrilateral,Trapezoid,Parallelogram,RectangleandSquare. Each and every one of these five classesMUSThave a methodcalled Area(), which calculates the area of the shape. You can choose how to design the rest of the program.Other Requirements:In addition, please also meet the following two best practices as much as possible:oMake your app as user friendly as possible (e.g., easy-to-follow user instruction; clearly presented result;meaningful error messages; etc).oAnnotate your program with comments properly so that others can easily follow your logic.Mathematical CheatSheet:ï‚·Mathematical hints to solve the problem (Check their accuracy!)oif YC= YD, then Shape ABCD is at least atrapezoidoif YC= YDand (XC-XD)= XB, then Shape ABCD is at least aparallelogramoif YC= YDand (XC-XD)= XBand XD=0, then Shape ABCD is at least arectangleoif YC= YDand (XC-XD)= XBand XD=0 and XC= Yc, then Shape ABCD is asquareï‚·How to calculate the areas of different shapes:Point A(0,0)Point B(XB,0)Point C(XC, YC)Point D(XD, YD)

Answers

(11)
Status NEW Posted 29 May 2017 02:05 AM My Price 9.00

-----------

Not Rated(0)