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

  Use a random-number generator to pick each card

Your program must incorporate a two-dimensional array to represent the suit and the value of each card dealt to a player, keep track of which cards have been dealt to which player, and use a random-number generator to pick each card to be dealt to..

  A savings account object holds a nonnegative balance

A savings account object holds a nonnegative balance, and provides deposit(k) and withdraw(k) methods, where deposit(k) adds k to the balance, and withdraw(k) subtracts k, if the balance is at least k, and otherwise blocks until the balance be..

  Defend why technology is the best of the three

Submit a discussion in which you examine UBR, CBR and ABR technologies. Choose one of these as the preferred method for transmitting data when bit-rate and minimum quality of service are top priorities and defend why this technology is the best..

  The sum of the angles of a triangle is always 180

The sum of the angles of a triangle is always 180. Get two angles from the user and display what the final angle must be in order to complete the triangle. Run the program to see the exact format of the output.

  Pseudocode

Allow the user to enter a series of temperatures in degrees Celsius (C) terminated by the input of - 999. For each one, find the corresponding temperature in degrees Fahrenheit (F). The conversion formula is:

  Describe the effect on equilibrium price and quantity given

Writing assignments are to be completed in APA format, double spaced, and 1-2 pages in length. In your response, be certain to answer all questions clearly and concisely

  Determine the funds received and use the text to column

In this project, you will be assigned the task to record money received for a school fundraiser and create an Excel spreadsheet to record your receipts. You will determine the funds received and use the text to column feature

  Explain intrinsic or extrinsic factors

Review your classmates' posts, and respond to at least two of your peers. Select at least one peer who noted different intrinsic or extrinsic factors than yours. Why do you think their factors are different

  Write an anonymous block that places a substitution variable

Write an anonymous block that places a substitution variable (&) into a local variable of type character. You should check the value entered in the local variable and output different messages depending on the value provided.

  Use a jframe or japplet as the primary interface

Use a JFrame or JApplet as the primary interface. Extend whatever Swing elements .you need to create the animationUse at least one interface to handle events

  Summarize the purpose of the sql language

Summarize the purpose of the SQL language

  Differences between data, voice, and video signals

Differences between data, voice, and video signals.  Include a description comparing the differences between a PBX and VoIP.  (200-350 words)

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