Create a class called book defines properties title

Assignment Help Basic Computer Science
Reference no: EM13892648

Please paste all of your code into this Word document and submit a single Word document for your solution.  Please enter your answers in bolded or a different color font, so they're easy to find - thanks!  Note that the PowerPoint and the MSDN website resource on Object-Oriented Programming for this week might be helpful.

1. Create a class called Book defines properties Title, Author and Year.  Add a method called Display() that outputs the Title and Author

2. Create a class called BookTest that uses an object initializer to create an object of class Book (from step 1) and initialize all of its properties.  Note: you will need to create a constructor method to do this 

Answer the following in essay form: 

3.Before adding a constructor method, describe what is called when we create an instance of type Book?

A: Constructors are uncommon routines used to introduce types and make occasions of types. A type constructor is utilized to instate static information in a type. A type constructor is called by the common language runtime (CLR) before any occurrences of the type are made. Type constructors are static (Shared in Visual Basic) and can't take parameters. A case constructor is utilized to make examples of a type. Occasion constructors can take parameters, yet are not required to do as such. An occasion constructor without any parameters is known as a default constructor.

4. What concept would we be practicing if we created two new constructor methods?

A: New constructor method create a new function in java

5. Why is it important to use exception handling?

A: Exception handling is important for handling exceptions in the program. We can easily handle them by using try catch blocks.

6.What's the purpose of private vs. public when we're adding new properties and/or methods to our class?  How does this apply to information hiding?

A:  PRIVATE

Visible to the class only (private).

Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself.

Private access modifier is the most restrictive access level. Class and interfaces cannot be private.

Variables that are declared private can be accessed outside the class if public getter methods are present in the class.

Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.

PUBLIC

Visible to the world (public).

A class, method, constructor, interface etc declared public can be accessed from any other class. Therefore fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe.

However if the public class we are trying to access is in a different package, then the public class still need to be imported.

Because of class inheritance, all public methods and variables of a class are inherited by its subclasses.

7. What is composition?  How could we use Composition in our Book class?

A: In the visual arts-in unique painting, image design, images, and sculpture-composition is the placement or association of visual factors or constituents in a work of art, as particular from the field of a piece. It can be proposal of because the institution of the elements of artwork in step with the principles of art.

The term composition manner 'putting together,' and can observe to any work of art, from track to writing to images, that's organized or put collectively utilizing mindful inspiration. In the visible arts, composition is ordinarily used interchangeably with various phrases such as design, form, visual ordering, or formal structure, depending on the context. In photo design for press and desktop publishing composition is probably known as web page layout.

8. What is data abstraction?

A:Data abstraction is one of the principle of object oriented programming. It is used to display only necessary and essential features of an object to outside the world.Means displaying what is necessary and encapsulate the unnecessary things to outside the world.Hiding can be achieved by using "private" access modifiers.

Reference no: EM13892648

Questions Cloud

Arctic cat''s current ratios compare to their industry : Key figures for the recent two years of Polaris and Arctic Cat follow.
Business risk and high financial risk : What industry has both high business risk and high financial risk?
Incorporate at least two research university of phoenix : Incorporate at least two research University of Phoenix library sources
What elements of your culture influence these schemas : What shortcuts (schemas, heuristics) did you use to form your inferences? How did these shortcuts help or hinder your decision-making process? What elements of your culture influence these schemas? Would a person from a different culture draw on a ..
Create a class called book defines properties title : 1. Create a class called Book defines properties Title, Author and Year.  Add a method called Display() that outputs the Title and Author 2. Create a class called BookTest that uses an object initializer to create an object of class Book (from step 1..
Multitude of differences with risk level : When investing in bonds, there are a multitude of differences with risk level, time to maturity, and specific provisions, etc. One such provisional feature is known as a sinking fund.
What standards should be used to establish a fair wage : What standards should be used to establish a fair wage? Or, what factors determine what someone deserves for wages? How would you describe the managerial philosophy of Walmart?
Identify logistics management strategies of zara : Identify logistics management strategies that enable Zara to become so successful - How can Zara maintain its competitive advantage, here the concept of sustainability may be introduced?
What attributes do you apply to these groups : Into what groups do you place people you meet? What attributes do you apply to these groups? What does the environmental context have to do with your initial impression

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write pseud code for 8-puzzle problem

write pseud code for 8-puzzle problem

  Might limit the effectiveness of storage protection

Describe residual data and how it might limit the effectiveness of storage protection/encryption approaches.

  Write organizational factors for benefits of new information

Write three organizational factors which can prevent a firm in completely realizing benefits of new information system, and give examples for each.

  Design a tick tac toe game

Design a Tick Tac Toe Game. You must use Arrays to represent the board You may use Pointers

  Make an argument for the state of the economy

Based on current data, make an argument for the state of the economy. Are we in a recessionary or inflationary gap? Neither? Are we in a deep recession? Are we in a large inflationary gap? If we are in neither, what direction (recession or inflation)..

  Describe multi-factor multiple means of authentication of a

question 1. explain multi-factor multiple means of authentication of a user and give two examples for each

  Explain format for storing-laying out objects on page

Describe the format for storing, laying out, and managing the objects on a page. Explain the advantages to the use of this format over other formats, such as that used by HTML.

  What is the difference between cdma and lte

What is the difference between CDMA and LTE? Is one technology better than the other?

  Average of the maximum employee salaries

Create a query that will return the average of the maximum employee salaries in each department. You will be gathering data from the employees table. Execute the query in Oracle Application Express (Apex).

  What is the inductive hypothesis

Show that the base case is true and What is the inductive hypothesis P(k)?

  On the spot courier services

On the Spot Courier Services On the Spot courier services grew and changed over the years. At first, Bill received requests for package pickups on his mobile phone, recorded that informa¬tion in a log, and would then drive around to retrieve all the ..

  What is the maximum amount of physical memory

Consider a logical address space of 256 pages with a 4-KB page size, mapped onto a physical memory of 64 frames.

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