Question

Need Help a Intro to Java Programming assignment Design a Area class that has three overloaded...

Need Help a Intro to Java Programming assignment

Design a Area class that has three overloaded static methods areaComputing to calculate the areas of circles, rectangles, and cylinders. Assume that data for circles and cylinders are all doubles and data for rectangles are integers. Code a test program AreaApp by creating at least two objects for each geometric shapes with different hard coded data at your choice for testing.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer : please up vote or comment for any query i will update the same .Thanks

Note : - check output images

Program :

Area Class :- Define and declare three areaComputing function to calculate area of rectangle,circle,cylinders

AreaApp main class : -which have main method to call function of Area class

Program : Area.java

class Area
{   //over loading function should have same return type
   public static double areaComputing(double Radius) //Area of Circle
{
double Area=3.14*Radius*Radius; //pi*RadiusRadius
       return Area;
}
public static double areaComputing(int a ,int b) //area of rectangle
{
return a*b;
}
  
   public static double areaComputing(double height ,double radius) //area of cylinder 2*pi*r*(r+h) total surface area
   {
       double Area=2*3.14*radius*(height+radius);
      
       return Area;
   }
  

}

AreaApp.java

class AreaApp //main class
{
   public static void main(String args[])
   {
      
       Area A=new Area(); //first object
       Area B=new Area(); //second objet
      
       System.out.println(A.areaComputing(1.32));
       System.out.println(A.areaComputing(10,20));
       System.out.println(A.areaComputing(10.1,20.9));
      
       System.out.println(B.areaComputing(1.32));
       System.out.println(B.areaComputing(10,20));
       System.out.println(B.areaComputing(10.1,20.9));
      
      
      
   }
}

Output

Add a comment
Know the answer?
Add Answer to:
Need Help a Intro to Java Programming assignment Design a Area class that has three overloaded...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java... Write a class that has three overloaded static methods for calculating the areas of the...

    Java... Write a class that has three overloaded static methods for calculating the areas of the following geometric shapes: • circles -- area = π*radius^2 (format the answer to have two decimal places) • rectangles -- area = width * length • trapezoid -- area = (base1 + base2) * height/2 Because the three methods are to be overloaded, they should each have the same name, but different parameters (for example, the method to be used with circles should only...

  • Can you please pick Automobile For this assignment. Java Programming Second Inheritance OOP assignment Outcome: Student...

    Can you please pick Automobile For this assignment. Java Programming Second Inheritance OOP assignment Outcome: Student will demonstrate the ability to use inheritance in Java programs. Program Specifications: Programming assignment: Classes and Inheritance You are to pick your own theme for a new Parent class. You can pick from one of the following: Person Automobile Animal Based on your choice: If you choose Person, you will create a subclass of Person called Student. If you choose Automobile, you will create...

  • Hi I need help creating a program in JAVA. This is material from chapter 9 Objects...

    Hi I need help creating a program in JAVA. This is material from chapter 9 Objects and Classes from the Intro to JAVA textbook. Mrs. Quackenbush's Rent-A-Wreck car rental ..... Mrs. Q asked you to create a program that can help her track her growing fleet of junkers. Of course she expects you to use your best programming skills, including: 1. Plan and design what attributes/actions an automobile in a rental fleet should have (example. Track number of Trucks, SUVs,...

  • Programming Assignment 6: A Python Class, Attributes, Methods, and Objects Obiectives .Be able to...

    I need some help with programming this assignment. Programming Assignment 6: A Python Class, Attributes, Methods, and Objects Obiectives .Be able to write a Python class Be able to define class attributes Be able to define class methods .Be able to process input from a text file .Be able to write an application using objects The goal of this programming assignment is to develop a simple image processing application. The application will import a class that creates image objects with...

  • Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What...

    Please complete the following programming with clear explanations. Thanks! Homework 1 – Programming with Java: What This Assignment Is About? Classes (methods and attributes) • Objects Arrays of Primitive Values Arrays of Objects Recursion for and if Statements Selection Sort    Use the following Guidelines: Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc.) Use upper case for constants. • Use title case (first letter is upper case) for classes. Use lower case with uppercase...

  • Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design...

    Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design and code a Java console application that reads in seven integer values and prints out the number of occurrences of each value. The application uses the Java single dimension array construct to implement its functionality. Your program output should look like the sample output provided in the "Count Occurrences in Seven Integers Using Java Single Dimension Arrays Instructions" course file resource. Full instructions for...

  • java. do it on eclipse. the same way its instructed Second Inheritance OOP assignment Outcome: ...

    java. do it on eclipse. the same way its instructed Second Inheritance OOP assignment Outcome:  Student will demonstrate the ability to understand inheritance Program Specifications: Programming assignment: Classes and Inheritance You are to pick your own theme for a new Parent class. You can pick from one of the following:  Person  Automobile  Animal  If you choose Person, you will create a subclass of Person called Student.  If you choose Automobile, you will create a...

  • Java Programming [20 marks] 3. (a Assume the following code has been implemented: public class ManipulateNames public s...

    Java Programming [20 marks] 3. (a Assume the following code has been implemented: public class ManipulateNames public static void main (String arqs) ( new Names ( Names myNames myNames.addName ("Thato"); myNames.addName ("Joe ") ; myNames.addName ("Susan") ; Page 2 of ?? Mobile Computing June 2016 COMS2013 myNames.addName ("James") ; myNames.printName (); int index-myNames.find ("Susan"); The Names class uses LinkedList object to store student names. The find method returns the position of the specified String in the LinkedList. Write [10 marks]...

  • Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the...

    Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows: public class Course...

  • this is for java programming Please Use Comments I am not 100% sure if my code...

    this is for java programming Please Use Comments I am not 100% sure if my code needs work, this code is for the geometric if you feel like you need to edit it please do :) Problem Description: Modify the GeometricObject class to implement the Comparable interface and define a static max method in the GeometricObject class for finding the larger (in area) of two GeometricObject objects. Draw the UML and implement the new GeometricObject class and its two subclasses...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT