Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Important concepts: - Java applications consist of a collection of classes; - classes can be used to create objects - many objects can be created

image text in transcribed
image text in transcribed
Important concepts: - Java applications consist of a collection of classes; - classes can be used to create objects - many objects can be created from one clas; - objects have operations (methods): - I methods may have parametes and return values; - Objects have a sate. A cade m ichonesty: Copying of work (texts, tab results etc.) from other students/groups or from other sources is not allowed. Assignments must be submitted on the due dates via Blackboard only. Write your name and id on first page of assignment. Your Marks Will Be Reduced For The Following Reasons - If Assignment Without Name And Id - If Submit Your Friend Assignment Without Changing The Names - If You Are Using The Public Static Void Main In The Program The marks are including to show the Program coding and output screen shot. Each question carries 5 marks (35=15) QI. Write a program in BlueJ using the following hints 1. Create a class named Book and declare the fields author, title and pages with suitable field types. 2. Declare the constructor and initialize the fields author and title with the assigned constructor parameter. 3. Name the constructor parameter as your own. 4. Add two accessor methods to the class getAuthor, getTitle and getPages - that return the author and title fields as their respective results. Add mutator method to change the pages of the Book class. QII. Write a program in Bluel using the following hints. 1. Create 2 classes named Person and Information in BlueJ. Draw an object diagram for a class Person. (Hint : Use class as datatype) 2. Create two constructors with the same name (Overloading) in a class person. One constructor having parameters and other one is empty parameter. 3. Add an accessor method in the class Information to return the name and id. 4. Print the person and information details with its method. 5. Show the output screen shot and program. QII. Answer the following. 1. Create a new class called Random Tester. 5.14 2. Create a constructor for the Random class and assign to the field. 3. Create 2 methods. 5.14 a) printOneRandom(Prints out one Random number) b) printMultiRandom(int howMany) -(Prints out appropriate Random numbers) 4. Create a method throwDice that returns a random number between 1 and 6 (inclusive- 0 to size-1) accessor method 5.16 5. Create a method name getResponse that randomly returns one of the strings "Yes"*, "no", "maybe" (5.17)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago