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

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  World data app

Prepare WorldDataApp project. It implements the NameIndex portion, including creating it in SetupProgram, and searching, viewing and updating it in UserApp program.

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  Lambert''s vacation rentals

Write an application for Lambert's Vacation Rentals. Use separate ButtonGroups to allow a client to select one of three locations, the number of bedrooms

  The string class and/or the stringbuffer class in java

Create a simple Java application that uses the String class and/or the StringBuffer class and at least 4 of the class methods. Show the code, demonstrate it works properly and describe what it is doing.

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  You need to train for 10 weeks

You are preparing for a marathon. In order to prepare, you need to train for 10 weeks, running an increasing number of miles per week, starting at running at least 2 miles your first week up to 26 miles by week 10.

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

  Correct example of inheritance

Which of the following relationships is not a correct example of inheritance?  Parent to Children  Aunt to Uncle  Grandparent to Grandchild

  Write specifications for method which advances date by one

Write specifications for the method which advances any given date by one day. Comprise a statement of purpose, pre- and post-conditions, and description of parameters.

  Write a program that simulate n rolls of six-sided die

Write a program that simulate n rolls of six-sided die and displays the frequency of occurrence of each side and What is the most likely method signature of the "parseInt() - TNE60003

  Java threads

This is an introductory assignment on Java synchronization. You will use Java Threads while learning more about concurrency and achieving atomicity using Java’s inbuilt mechanisms.

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