Demonstrate the use of all of your constructors

Assignment Help JAVA Programming
Reference no: EM133364994

Question One

You should complete this question in week one.

Your activity is to complete the QuestionOne class. In the class, you must:
Have at least four instance variables of different data types, with at least one primitive and one wrapper.
Make use of constructor overloading i.e. Have more than one constructor.
Have accessor (getter) and mutator (setter) methods for ALL instance variables.
Have a method that prints the contents of all of the instance variables. The output must be formatted for readability. For example if you have an instance variable called age that has a value of 7 you might print something like The age is 7.
Have a method with an if-else statement that takes uses the value of one of the instance variables in the condition and prints a message based upon the value.
You must complete the following in the main method:
Demonstrate the use of all of your constructors i.e. use each constructor in the class to create a QuestionOne object.
Demonstrate the use of an accessor method i.e. use one of the accessor methods from one of the objects you just created.
Demonstrate the use of an mutator method i.e. use one of the mutator methods from one of the objects you just created. .
Demonstrate the use of the method that prints the contents of all of the instance variables i.e. use the print method from one of the objects you just created.
Demonstrate the use of the method with the if-else statement i.e. use the method with the if-else statement from one of the objects you just created.
Make sure you:
Add class comments, with your name as author and date as the last date you worked on this exercise.
Add comments to describe the instance variables and methods in the class.
Name all variables and methods as per Java naming conventions.

Question Two
You should start this question in week one and finish it in week two.

Your activity is to complete the QuestionTwo class. In the class, you must:
Declare an Array of data type double and insert at least five values to the Array.
Loop through the Array and for each element (double value that you inserted) in the Array, print the following formatted for readability:
The index of the element.
The absolute value of the element (hint - you will need to use one of the methods from the Math class covered in module 1).
The value of the element rounded up to its nearest integer (hint - you will need to use one of the methods from the Math class covered in module 1).
The value of the element rounded down to its nearest integer (hint - you will need to use one of the methods from the Math class covered in module 1).
The square root of the element (hint - you will need to use one of the methods from the Math class covered in module 1).
The result and remainder when the element is divided by the number of elements in the Array i.e. an int that is equal to the size of the Array (hint - you will need to use the division and modulus operators covered in module 1).
Please note that the above must print when the main method runs. How you do this is up to you. You can write all of the code in the main method for this question if you like.
Make sure you:
Add class comments, with your name as author and date as the last date you worked on this exercise.
Add comments to describe the instance variables and methods in the class.
Name all variables and methods as per Java naming conventions.

Question Three
You should start this question in week two.

Your activity is to complete the QuestionThree class. In the class, you must:
Declare an Array of data type String as an instance variable.
Initialize the Array. Generate a random number and use the random number as the Array size. You do not need to add elements to the Array when initializing it (hint - you can do this in the constructor. Generating random numbers is covered in module 1. If you can not do this then you can give the array a size of your choosing).
Have a method that takes a parameter and adds the parameter to the Array. A suitable error message must be given if the Array is full.
Have a method that sorts the Array.
Have a method that prints all of the elements in the Array.
Using the methods that you wrote, you must do the following in the main method:
Create an object of type QuestionThree.
Use the method that you wrote to add at least five elements to the Array.
Use the method you wrote to print all of the elements in the Array.
Use the method you wrote to sort the Array.
Use the method you wrote to print all of the elements in the Array again to demonstrate that the sort method you wrote successfully sorted the Array.
Make sure you:
Add class comments, with your name as author and date as the last date you worked on this exercise.
Add comments to describe the instance variables, and methods.
Name all variables and methods as per Java naming conventions.

Verified Expert

In this project Created three java files.In the first Java file, constructors, mutators and accessors.In the second Java file created the array of double and various Mathematical methods,Randomly generated input size for arrays and added elements to array.

Reference no: EM133364994

Questions Cloud

Discuss the likely effects on labor force participation : Draw the current daily budget constraint (assume a wage that is net of the hourly child-care costs) for a single mother and then draw in the new constraint.
Analysis of project management leadership styles : What are the salient considerations in the selection of an appropriate Project Manager for IT driven transformational project?
Steer negotiations between labor and management : How could you help steer negotiations between labor and management, so the conflict between them is healthy and productive? Is it even possible?
What will be the total output of the industry and the price : Assume that in equilibrium before trade, there are 20 firms, each firm producing 20 units What will be the total output of the industry and the price of output?
Demonstrate the use of all of your constructors : Demonstrate the use of all of your constructors i.e. use each constructor in the class to create a QuestionOne object
How many total meals are cooked by co-op members : How many total meals are cooked by co-op members? How many total parties are thrown by the co-op? Justify your answer mathematically.
Recall some of your more interesting projects : Recall some of your more interesting projects and think of times when there was a misalignment between what was formally presented as the set of requirements
What is role or importance of supply chain generally : What is the role or importance of Supply chain generally.
Regarding team communication and collaboration : Regarding team communication and collaboration, what are the challenges in managing a virtual team in adopting a change management process using agile?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Looking for help setting-up a java class

Looking for help setting-up a Java class, with the following requirements:

  1 linked listsin this problem you will write a class that

1 linked listsin this problem you will write a class that implements an ordered list of strings. your class will able

  Explain polymorphism

Explain polymorphism. Do all programming languages have polymorphism, and why or why not? Why is it useful and identify situations where polymorphic behavior would be absolutely necessary

  Create three new threads

Write a program (in C, or Java, or C++, or C#) that creates three new threads (besides the already existing main thread) and synchronizes them in such a way that each thread displays it's thread id in turn for 5 iterations

  What are advantages of java as compared to the other two

What are the advantages and disadvantages of Java as compared to the other two? Your report should include a use case describing the career path of a Java developer in the IT industry.

  Define private instance variable to hold boolean value

Write a Java Enumeration "LetterGrade" that represents letter grades A through F including plus and minus grades. Define a private instance variable to hold a boolean value.

  What is the smallest positive number representable

What is the smallest positive number (not including the +0) and largest negative number representable in 32-bit IEEE 754 single precision floating point?

  What is a single line of java code to make an object

What is a single line of Java code to make an object called car from the Vehicle class. Assume the class has a default constructor

  Write a method to save a linked list to a text file

Write a method to save a Linked List to a text file called file.txt. It must save the Linked List to the file with each node on a different line.

  Provide an example of when a transaction would be useful

Explain what a transaction is in a database context and provide an example of when a transaction would be useful?

  Determine the number of different variable names in java

The name of a variable in the JAVA programming language is a string of between 1 and 65,535 characters, inclusive, where each character can be an uppercase.

  Expressions in the matlab command window

These problems all involve typing expressions in the MATLAB command window. To complete this homework assignment, turn in a text (or Word, or PDF) file containing the expression that you type to respond to each problem.

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