Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java language Question 1 : A Shape class is given. The Shape class has one data member: type (String), which is used to store

in java language

Question 1 : A Shape class is given. The Shape class has one data member: type (String), which is used to store the type of shape (Rectangle, Right triangle, Square, Circle, etc.) and two abstract methods as specified in the following method signatures-both methods return a double value: perimeter() and area() Write a subclass named RightTriangle, which inherits from Shape. A right triangle has three sides: the longest side, opposite the right angle, is called the hypotenuse, which is labeled as c. The other two sides are called the legs of the triangle, they are labeled as a and b. All a,b,c should be declared as double data type and no any other additional data members in the right triangle class; All three sides are limited to [1.0, 100.00] and the three sides can forma a right triangle (Pythagorean theorem). Otherwise, set to their default values: a=3, b=4, c=5) provides all mutator and accessor methods implements perimeter and area methods. provides a constructor (takes 3 parameters: a,b,c that creates a right triangle object Write a subclass named Square, which inherits from Shape. A square has four sides with the same length, so you need to define one variable named side (double type, a side is limited to [1.0, 100.0], otherwise, default to 10.0) implements perimeter and area methods. provides a constructor (takes one parameter: side) that creates a square object. provides all mutator and accessor methods override toString method for both subclasses: for Right triangle class, toString returns, for example: Right Triangle[a:3.00; b:4.00; c:5.00; Perimeter: 12.00; Area: 6.00] for Square class, toString returns, for example: Square[side: 10.00; Perimeter: 40.00; Area: 100.00] 

Question 2 : Design a programming named CharDistribution.java, which counts how many times each of the alphabetic characters appears in the

data file (char.txt). Then print the result as a histogram as specified as follows:

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ---------------------------------------------------- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

NOTE: You MUST accept the file name from command argument list: Scanner input=new Scanner(new File(args[0]));

Otherwise, you will get zero for this question.

char.txt

The 22-member Greater Richmond Solar Co-op today issued a request for proposals (RFP) from area solar installers. The group members

created the co-op to save money and make going solar easier, while building a network of solar supporters. Drive Electric RVA, the Richmond Temple,

RVA HUB and VA SUN are the co-op sponsors.

Local installers interested in serving the group can download the RFP here and response template here. Richmond-area residents interested

in joining the co-op can sign up at www.vasun.org/richmond.

Joining the co-op is not a commitment to purchase panels. Co-op members will select a single company to complete all of the installations.

They will then have the option to purchase panels individually based on the installer?s group rate. By going solar as a group and choosing a single installer,

participants can save up to 20% off the cost of their system.

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions