Create program perform error-checking on the initial values

Assignment Help JAVA Programming
Reference no: EM131114109

1: Cylinder (In this lab you will create programs that use classes and methods.)

Create a class called Cylinder.java that contains two double-precision instance variables named radius and height. The class should include a constructor that initializes the radius and height variables. Also, you need a class method named volume() that returns the volume of a Cylinder object. The volume of a cylinder is given by its radius squared times its height times Pi (radius * radius * height * Math.PI). You can either use the value 3.1416 for Pi or use the Java provided value named Math.PI.

Write a class called CylinderTest.java and declare an array of three Cylinder objects to call the methods you declared in the Cylinder class. Make sure that all class methods are called from main(). Have main() display the value returned by volume() and verify the returned value by hand calculations (paper/pencil). Prompt the user to enter the values for the radius and height of each Cylinder object in the array.

2: Date (In this lab you will create programs that use classes and methods.)

Create a program called Date.java to perform error-checking on the initial values, for instance: fields month, day, and year. Also, provide a method nextDay() to increment the day by one. The Date object should always remain in a consistent state.

Write a program called DateTest.java that prompts the user to enter the month, day, and year as numeric values. This program then creates a Date object using the Date class you just created and tests the nextDay() method. This can be done in a loop of 40 iterations: the Date object calls the nextDay() method and prints the date during each iteration of the loop. This loop is to illustrate that the nextDay() method works correctly. Test the following cases:

1. Incrementing into the next month, for example, use date: 02/28/2011
2. Incrementing into the next year, for example, use date: 11/27/2011
3. Incrementing into the next month in a leap year, for example, use date: 02/28/2012

Reference no: EM131114109

Questions Cloud

Analyze the future of criminal justice policy : Describe your thesis regarding the future of criminal justice policy making. Analyze the future of criminal justice policy. Describe the limitations associated with criminal justice policy making
Explain the cause of any difference in katharines selves : How did Katharine's self-concept differ from her ideal self before her expe- rience with her support group? What does this imply about her mental health, according to Rogers' theory?
Produce the pseudocode logic for an algorithm : Produce the pseudocode logic for an algorithm that will compute the discount for each customer. The information is given as follows: The output will consist of a screen display showing the customer's discount received.
Describe the significant manner court rulings in juvenile : Describe the significant manner in which the court rulings in juvenile delinquency cases have altered the judicial system's treatment of juveniles as compared to the treatment of adults
Create program perform error-checking on the initial values : Create a program called Date.java to perform error-checking on the initial values, for instance: fields month, day, and year. Also, provide a method nextDay() to increment the day by one.
Explain advantages of promoting social tolerance : Using a child development theory of your choice, explain the advantages and disadvantages of promoting social tolerance among children under the age of 10.
Determining the company stock today : Schiiller Corp will pay a $2.94 per share dividend next year, The company pledges to increase its dividend by 4.5 percent per year, indefinitely, If you require a return of 12 percent on your investment, how much will you pay for the company's sto..
Question regarding the value of the bond today : Two years ago, you bought a fifteen year bond at its face value of $1,000. The coupon rate on this bond is 9%, payable annually. Today (just after receiving the second annual coupon payment), the current yield on the bond is 7.5%. What is the valu..
What is the npv of the project : What is the NPV of the project? Round your answer to the nearest cent. What is the NPV of the project? Round your answer to the nearest cent.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Mean and standard deviation using using eclipse

Java programming to calculate Mean and standard deviation using Using Eclipse.

  Calls the function readarray to read data into the array

Write a function void readArray(int arr[], int length) to read in length many values into the array arr.

  This project is for designing and developing a college

this project is for designing and developing a college registration program. prepare a java program to register

  List all of the rooms which must be traversed

List all of the "rooms" which must be traversed, in the form of a path of room coordinates, from the start to finish. The input file will consist of 100 rows of 100 digits, 00-99.

  Write a method in java that uses a switch statement

Write a method in JAVA that uses a switch statement and takes a person's age using an integer parameter , then checks if the age is valid (0-110), and then RETURNS a string based on the age

  Building your own er model editor

Take user input from GUI and normalize the relationship between entities - important components of ER-model Editor - ER-Diagram Editor and code generator. This would involve building our own ER model editor that would allow user to add their own SQL..

  There are different ways you can use virtulazation one

write a 200- to 300-word short-answer response to the following there are different ways you can use virtulazation. one

  Create a class called employee with name idno address and

create a class called employee with name idno address and phone number as attributes. create the setter and getter

  Pronouns, and prepositions

Type addKeyword(): for each word on each page, add to a (keyword, URLs) list or dictionary, excluding articles, pronouns, and prepositions. For example:

  The fancy new french restaurant la food is very popular for

the fancy new french restaurant la food is very popular for its authentic cuisine and high prices. this restaurant does

  Note the line number in the statement

Note the line number in the statement

  The williamsburg women''s club

The Williamsburg Women's Club offers scholarships to local high school students who meet any of several criteria. Write an application that prompts the user for a student's numeric high school grade point average (for example, 3.2), the student's num..

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