Create an abstract class named element

Assignment Help JAVA Programming
Reference no: EM13161131

Part 1: Create an abstract class named Element that holds properties of elements, including their symbol, atomic number, and atomic weight. Include a constructor that requires values for all three properties and a get method for each value. (For example, the symbol for carbon is C, its atomic number is 6, and its atomic weight is 12.01. You can find these values by reading a periodic table in a chemistry reference or by searching the Web.) Also include an abstract method named describeElement(). Create two extended classes named MetalElement and NonMetalElement. Each contains a describeElement() method that displays the details of the element and a brief explanation of the properties of the element type. For example, metals are good conductors of electricity, while nonmetals are poor conductors.Write an application named ElementArray that creates and displays an array that holds at least two elements of each type. Save the files as Element.java, MetalElement.java, NonMetalElement.java, and ElementArray.java.

Part2: Create a class named NewspaperSubscriber with fields for a subscriber's street
address and the subscription rate. Include get and set methods for the subscriber's
street address, and include get and set methods for the subscription rate. The set
method for the rate is abstract. Include an equals() method that indicates two
Subscribers are equal if they have the same street address. Create child classes
named SevenDaySubscriber, WeekdaySubscriber, and WeekendSubscriber. Each
child class constructor sets the rate as follows: SevenDaySubscribers pay $4.50 per
week, WeekdaySubscribers pay $3.50 per week, and WeekendSubscribers pay
$2.00 per week. Each child class should include a toString() method that returns
the street address, rate, and service type. Write an application named Subscribers
that prompts the user for the subscriber's street address and requested service, and
then creates the appropriate object based on the service type. Do not let the user
enter more than one subscription type for any given street address. Save the files as
NewspaperSubscriber.java, WeekdaySubscriber.java, WeekendSubscriber.
java, SevenDaySubscriber.java, and Subscribers.java.

Part3:Picky Publishing House publishes stories in three categories and has strict requirements
for page counts in each category. Create an abstract class named Story that
includes a story title, an author name, a number of pages, and a String message.
Include get and set methods for each field. The method that sets the number of pages
is abstract. Also include constants for the page limits in each category. Create three
Story subclasses named Novel, Novella, and ShortStory, each with a unique
setPages() method. A Novel must have more than 100 pages, a Novella must have
between 50 and 100 pages inclusive, and a ShortStory must have fewer than
50 pages. If the parameter passed to any of the set methods in the child class is out of
range, set the page value but also create and store a message that indicates how many
pages must be added or cut to satisfy the rules for the story type. Write an application
named StoryDemo that creates an array of at least six objects to demonstrate how
the methods work for objects created both with valid and invalid page counts for
each story type. For each story, display the title, author, page count, and message
if any was generated. Figure 11-34 shows a sample execution. Save the files as
Story.java, Novel.java, Novella.java, ShortStory.java, and StoryDemo.java.

Part4:Write an application named UseInsurance that uses an abstract Insurance class
and Health and Life subclasses to display different types of insurance policies
and the cost per month. The Insurance class contains a String representing the
type of insurance and a double that holds the monthly price. The Insurance class
constructor requires a String argument indicating the type of insurance, but the
Life and Health class constructors require no arguments. The Insurance class
contains a get method for each field; it also contains two abstract methods named
setCost() and display(). The Life class setCost() method sets the monthly fee
to $36, and the Health class sets the monthly fee to $196. Write an application
named UseInsurance that prompts the user for the type of insurance to bedisplayed, and then create the appropriate object. Save the files as Life.java,
Health.java, Insurance.java, and UseInsurance.java.

 

 

Reference no: EM13161131

Questions Cloud

How the resulting interference pattern will di ffer : Briefly describe how the resulting interference pattern will di ffer for the various types of particles passing through: protons, electrons, neutrinos (mass close to zero) and photons. Assume that the distribution of particle energies is the same f..
What is a sensitized sheep rbc : Briefly explain how a complement fixation test is used to determine the etiological agent of a disease or in other words whatdoes this test tell us about the patient.
Clearly label the ir spectrum of anisaldehyde : Clearly Label the IR Spectrum of Benzoic Acid and assign the following peaks: Broad 3300-2500cm-1 3020 cm-1 1682cm-1 2. Clearly Label the IR Spectrum of Anisaldehyde and assign
Remember to make only one step at a time : Prove the following. Remember to make only one step at a time and not skip steps. Remember to write what rule allowed you to make each step, and which lines you applied it to
Create an abstract class named element : Part 1: Create an abstract class named Element that holds properties of elements, including their symbol, atomic number, and atomic weight. Include a constructor that requires values for all three properties and a get method for each value.
Determine the enthalpy change for the reaction : Determine the enthalpy change for the reaction. 2NO2 (g) -> 2NO(g) + O2(g) These are the given equations: NO + O3 -> NO2 + 02 DeltaH = -198.9 kJ / mol O3 -> (3/2)O2 DeltaH = -142.3 kJ/mol
Determine the dominant and recessive expression of the gene : determine the dominant and recessive expression of the gene?
Briefly describe the process to separate the two ions : The two ions are mixed in a solution and you need to pick a chemical to add that would allow you to selectively remove one of them. Briefly describe the process you would use to separate the two ions.
Provide the rtl instructions : Provide the RTL instructions and the time steps that will facilitate the execution of the following assembly language instructions  LDA addr,x  STX addr,x

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program that asks the user to enter three names

Write a program that asks the user to enter three names

  Create the html form and call the servlet to print out

1. write a calculator Servlet that adds, subtract, multiples and divides. Create the html form and call the servlet to print out the answer

  Explain how the loop displaying the menu

Explain how the loop displaying the menu is exited, what value does menuSel have when the program finishes? Describe what happens next when menuSel gets this value.

  Java program to find a value at in index

Construct a main class named Array Program that generates an array of 50-integers, all ranging from one to one hundred.

  Bilinear and nearest neighbour algorithm in java

How to do bilinear and nearest neighbour algorithm in java. Show how to eliminate change in pixel aspect ratio in java.

  Write java program to accept two words as input

Write a Java program that accepts two words as input and determines if one of them is resulting from changing the order of the others' letters.

  Java program use breadth-first search closest broadcast

Write the java program which will use breadth-first search (which you implement as part of your program) to determine the closest broadcast vertex for each vertex in graph.

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Eclipse or netbeans environments

As recommendation, you can try to use Eclipse or NetBeans environments that are used also for other courses as: Introduction in Java programming and Intermediate programming.

  Write java program to select pine for furniture company

Write down the Java program for the furniture company. Ask user to select P for Pine, O for Oak or M for Mahogany.

  Java program editing

Prompt the user for the student's score and put that value into an object

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