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

  Design a java class to represent a 3-d geomtetric shape

Design and implement a Java class to represent a 3-D geomtetric shape of your choice. The class should contain a constructor, appropriate data fields and methods to return the volume of the shape, and the surface area of the shape and any other me..

  Program to calculate the average of 5 numbers entered.

Show what the PC monitor will show when the program is executed with the following values used: 27, 12, and 15.

  Compute the total annual compensation of a salesperson

Write a Java application using NetBeans Integrated Development Environment (IDE) that calculates the total annual compensation of a salesperson. Consider the following factors: A salesperson will earn a fixed salary of $35,750

  Simple single-server queue has one line of waiting

simple single-server queue has one line of waiting customers and one server who wait on customers. suppose that

  Write program in java to calculate interest

Write a program in java to do the following : the following data is stored for each customer in the bank: account number,average balance and number of transaction for each customer it is required to calculate the interest earn

  Advantages and disadvantages of inline functions

advantages and disadvantages of inline functions

  Can you provide the output of this program

Can you provide the output of this program - What is the output of following JavaScript code?

  Programming languages for example pascal

Some programming languages for example Pascal have used the semi colon to seperate statements while java uses it to terminate the statements. which of them in your opinion is most natural and least likely to result in syntax errors? support your a..

  Prepare executable programs a translate program and a

prepare executable programs. a translate program and a dictionary program. the programs will be written in any

  Java program that reads an input

Create a java program that reads an input of n lines with the first line being the number of people in the contest and the remaining lines a numeric 9 digit code for each person that gets a vote

  Standard methods-processes for developing client solution

The company has an excellent IT department with experienced staff.As a consultant, you bring to the table standard methods and processes for developing the client solution.

  Java programming using netbeand

Java Programming using Netbeand- In this assignment, you will be asked to demonstrate what you have learned in the Discussion Board in terms of vector, wrapper classes, conversion, and collection data structures by writing and implementing Java co..

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