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 the definition of the function

Write the definition of the function, leavesCount, that takes as a parameter a pointer to the root node of a binary tree and returns the number of leaves in a binary tree. Add this function to the class binaryTreeType and create a program to test ..

  Differentiate between parallel and serial busses

Question1 :  One large modern computer has a 48-bit memory address register. How much memory can this computer address? Question 2 : What is the function of registers in the fetch-execute instruction cycle? What is the purpose of the instruction regi..

  Evaluate why cost is not one of the five core metrics

Evaluate why cost is not one of the five core metrics of the SLIM model and speculate on the consequences if cost served as one.

  Determine the effective miss rate

For the following repeating sequence of 1w address (given in hex) and cache configurations... Assuming least recently used (LRU) replacement for associative caches,

  Design a program that prompts the user to enter a string

Using Python version 2.7, design a program that prompts the user to enter a string.The program should then display the number of vowels and the number of consonants in the string. I am absolutely lost and don't even know how to start, any assistan..

  Design a file system checker for our file system

Design a file system checker for our file system. You should call it csefsck. It will have to do the following: The DeviceID is correct All times are in the past, nothing in the future Validate that the free block list is accurate this includ..

  Find the binary, octal and hexadecimal representations

Find the binary, octal and hexadecimal representations for each of the following integers (given in base 10).

  Explain specific challenges facing the designer

Discuss the specific challenges of facing the designer, specifically with regard to the limitations of hardware, software and interface design two paragraph each.

  Describe what each of the two-dimensional characters

Describe what each of the two-dimensional characters might represent and the data that would be held in the array. Also, provide an example array declaration.

  Write the method getcoinflips that takes a number of flips

Write the method getCoinFlips that takes a Coin and a number of flips as parameters. The method should return an array of the booleans produced by flipping the Coin the given number of times.

  What is the size of a char and a string

What are the sizes in memory of other data types in C++? I mean, I know that a double is 8 bytes and an int is 4 bytes. What is the size of a Char and a String?

  Ratio of the frequency of the second processor to first one

The frequency of the processor is proportional to the voltage at which it is run. Considering only dynamic power, what will be the ratio of the frequency of the second processor to the first one?

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