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

  Part 1product maintenanceyoull create a series of pages

part 1product maintenanceyoull create a series of pages that allow you to add update or delete a product thats

  Creates a temporary array as part of merging

The textbook's Sorts.java merge() method creates a temporary array as part of merging, which is wasteful of computer memory. An alternative would be to store data to be sorted in a linked list rather than an array and to merge "in place" within th..

  Create a java class named headphones

1. Create a Java class named HeadPhones to represent a headphone set. The class contains:

  Implement simple java program to input syllabus grades

To implement simple Java program to input (hypothetical) syllabus grades, computing and displaying both normal Mean and Harmonic Mean.

  Description of routes and services

Write a method for finding a journey from one station to another using an algorithm that is specified below in this handout.

  Class named person with fields for holding a person''s name

Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields.

  Develop a program that will handle a golfer and his scores

develop a program that will handle a Golfer and his scores. The program will be comprised of two classes: a Golfer class that will manage all the golfer's scores and a Score class.This is a class designed to represent a golfer including his name, hom..

  Web engineering principles

web application development, Web Engineering methodology, UML-based Web Engineering (UWE), models to the expansion of web applications, Object Oriented Web Solutions (OOWS),Web Modeling Language (WebML) methodology, Object-Oriented Hypermedia Design..

  Define application using java in the eclipse environment

Within this project create a package called task01. Within this package you will be required to author (write, develop) some classes. These classes are described below

  Java project

Prompt the user for an int between lower and upper boundary.

  Client server monitoring system project design

client server monitoring system project design. The server adminstation can send messages to the clients and DESIGN WITH JAVA NETBEANS AND GUI.

  The department of community affair- jail report

The Department of Community Affairs (DCA) for the State of Georgia performs many functions including gathering statistics and doing research. DCA provides a monthly jail report that provides some interesting information about jails in the state.

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