Write two subclasses of Shape called Circle and Rectangle, as shown in the class diagram.
a) The Circle class contains:
· An instance variable radius (double).
· Three constructors as shown. The no-arg constructor initializes the radius to 1.0.
· Getter and setter for the instance variable radius.
· Methods getArea() and getPerimeter().
· Override the inherited toString() method, to return "A Circle with radius=xxx, which is a subclass of yyy", where yyy is the output of the toString() method from the superclass.
b) The Rectangle class contains:
· Two instance variables width (double) and length (double).
· Three constructors as shown. The no-arg constructor initializes the width and length to 1.0.
· Getter and setter for all the instance variables.
· Methods getArea() and getPerimeter().
· Override the inherited toString() method, to return "A Rectangle with width=xxx and length=zzz, which is a subclass of yyy", where yyy is the output of the toString() method from the superclass.
a) Write a class called Square, as a subclass of Rectangle. Convince yourself that Square can be modeled as a subclass of Rectangle. Square has no instance variable, but inherits the instance variables width and length from its superclass Rectangle.
· Provide the appropriate constructors (as shown in the class diagram). Hint:
public Square(double side) {
super(side, side); // Call superclass Rectangle(double, double)
}
· Override the toString() method to return "A Square with side=xxx, which is a subclass of yyy", where yyy is the output of the toString() method from the superclass.
· Do you need to override the getArea() and getPerimeter()? Try them out.
· Override the setLength() and setWidth() to change both the width and length, so as to maintain the square geometry.
a) Write a superclass called Shape (as shown in the class diagram), which contains:
· Two instance variables color (String) and filled (boolean).
· Two constructors: a no-arg (no-argument) constructor that initializes the color to "green" and filled to true, and a constructor that initializes the color and filled to the given values.
· Getter and setter for all the instance variables. By convention, the getter for a boolean variable xxx is called isXXX() (instead of getXxx() for all the other types).
· A toString() method that returns "A Shape with color of xxx and filled/Not filled".
Write a test program to test all the methods defined in Shape.
Student information Window
The data should be saved in a file.
The student record may be deleted.
The student record may be searched based on the ID provided.
The student record may be updated in case if its phone no or house address changes.
Determine the member forces and the reaction forces for the truss structure shown in figure with proper assumptions
Write a python function C-F(X) which takes a dictionary containing numbers as input. The function will return a dictionary containing key as a number and value as frequency of how many times the number is repeating in the dictionary. For Ex: 1) {'V': 10, 'VI': 10, 'VII': 40, 'VIII': 20, 'IX': 70, 'X':80, 'XI': 40, 'XII': 20 } is input , then output is { 10: 2 , 20: 2 , 40:2 , 70: 1 }.
2) input: {1: 10, 2: 20, 3: '30', 4: '10', 5: 40, 6: 40} output: {10: 1, 20: 1, '30': 1, '10': 1, 40: 2} .
Function should be general and should work for any finite items dictionary.
A gas has a volume of 3.00 L and a pressure of 75.4 kPa. when the volume expands to 4.00 L and the pressure drops to 72.7 kPa, the gas temperature is 0C. what was the initial temperature of the gas?
A member ABCD is subjected to point loads P1, P2, P3 and P4 as shown in Fig. Calculate the force P3,necessary for equilibrium if P1 = 120 kN, P2 = 220 kN and P4 = 160 kN. Determine also the net change in length of the member. Take E = 200 GN/m2.
Direct stresses of 120 N / mm ^{2}N/mm2 (tension) and 90 N / mm ^{2}N/mm2 (compression) are applied at a particular point in an elastic material on two mutually perpendicular planes. The principal stress in the material is limited to 100 N / mm ^{2}N/mm2 (tension). Calculate the allowable value of shear stress at the point on the given planes. Determine also the value of the other principal stress and the maximum value of shear stress at the point. Verify your answer using Mohr’s circle.
is programming example taken out of the textbook by D.S. Malik demonstrates a program that calculates a customer’s bill for a local cable company. There are two types of customers: residential and business. There are two rates for calculating a cable bill: one for residential customers and one for business customers. For residential customers the following rates apply:
For business customers the following rates apply:
write the flowchart and pseucode for question