Create a program called date java to perform

Assignment Help JAVA Programming
Reference no: EM13765385

Arrays, Classes, and Objects:

Program files for each of the following three programs.

1. Cylinder & Cylinder test

2. Date & Date test

Step 1: Cylinder

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 namedvolume() 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.

Step 2: Date

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:

Reference no: EM13765385

Questions Cloud

Program to record the temperature and pressure : Write a program to record the temperature and pressure values in a scientific experiment and store the data in two one-dimensional arrays, then identify the extreme values of pressure and temperature. The array size is 20.
What is the available net working capital : On March 31, Adolpha, Inc. reported the following information on its financial statements. What is the available net working capital for Adolpha, Inc.?
Is jim likely to succeed : Steve buys a house from Jim. There is no written contract. However, Steve pays the purchase price, moves onto the property, and begins to build a new garage. Jim seeks to evict Steve from the property stating that there was never a valid contract...
Outsourcing-a strategic advantage : Outsourcing may provide tremendous advantages for firms. It may allow companies to specialize, reduce costs, and focus narrowly on the core competencies they deem strategic; however, companies also have to think about what they may lose both quali..
Create a program called date java to perform : 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.
Relation between present values and interest rates : What do your answers to these questions tell you about the relation between present values and interest rates and between present values and the number of compounding periods per year? Calculate the future value in five years of $5,000 received today..
What traditional in emily dickinson and paul laurences work : what traditional in Emily Dickinson and Paul Laurence Dunbars work. Compare and contrast Dickinson's "I'm nobody, who are you" and Paul Laurence Dunbar's "We Wear the Mask." Consider structure as well as content.
Designing value-based service : As the rate of innovation increases, companies face expanding product/service lines, shorter product and service lifecycles, and more frequent product/service transitions. All of these can bring tremendous value but also pose enormous challenges a..
Software services versus software components : Provide an example of a software component and another example of a software service. Explain what these examples have in common and how they differ.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a java program to read sequences of integers

Write a Java program to read sequences of integers from a text file, build a binary search tree for each sequence by inserting numbers in the sequence one after another into the search tree, and plot a picture of the finished tree.

  Declare a string variable named empty

Declare a string variable named empty, and initialize it to the empty string.

  What would be an incorrect way of writing this equation

Jim develops 5 Java applications a year. Joe develops 10 Java applications a year. Jim gets paid $5000.00 per application, but Joe gets paid $10000.00 per application.

  Start developing java code to ask questions

You are ready to start developing Java code to ask questions on customer information and the sub that customers want to order. You are only concerned with the functionality to request and provide feedback on what the customer entered

  Write the methods used in section two of main

Write the constructor for the SortTraversableLinkedList. It should create the head and tail nodes, and set the size of the list to 0, as in a typical linked list.

  Programming exercises

Programming Exercises 1. Write an application named BadSubscriptCaught in which you declare an array of 10 first names. Write a try block in which you prompt the user for an integer and display the name in the requested position.

  Problem 1write a java class called problem1 implement the

problem 1write a java class called problem1. implement the following method in your classpublic static int

  Write the method called print triangle type.

Write the method called printTriangleType. This method accepts three integer arguments representing the lengths of the sides of a triangle and prints the type of triangle that these sides form. Here are some sample calls to printTriangleType

  Test plan for both unit testing and integration testing

Do a test plan for both unit testing and integration testing, justification why you need this test creating the test case for each individual test must use java language in netbeans IDE to perform each test, screen capture one example to run the ..

  The application with all the specifications should be

the application with all the specifications should be developed based on a graphical user interface.1. implement proper

  Write a program that converts date formats

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12,..., Z for 35. (Hint: use the case..

  The java code conventions

The database must be able to retrieve client information and display it on the screen for a specific telephone number match. The program must be well commented and documented using javadoc. The program must conform to the Java Code Conventions

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