Reputation: 1151
I missed class this week, due to my son being sick and I missed this portion of the lecture for the week. This is example below is what they went over in class but im having a hard time understanding what needs to be done and the book nor the teachers examples are clearly expressed so that I can understand. I guess what I need is some guidance and code this so that I can get a visual representation of what to do for my homework assignment. Thank you very much in advance.
From the following UML diagrams write the C# classes and the programs to test them.Assume you are using empty-argument constructors and public properties.
**Book**
-Title
-Author First Name
-Author Last Name
-ISBN Number
+checkOut
+CheckIn
Upvotes: 0
Views: 180
Reputation: 14468
Also helpful to look at the syntax first: http://en.wikipedia.org/wiki/Class_diagram.
Upvotes: 1
Reputation: 42003
public class Book
{
public string Title { get; set; }
public string AuthorFirstName { get; set; }
public string AuthorLastName { get; set; }
public string ISBNNumber { get; set; }
public void checkOut()
{
// code to check out here
}
public void CheckIn()
{
// code to check in here
}
}
..But, you did not provide enough information as to what the checkOut/CheckIn (inconsistent case by the way) have to do. No need for a constructor here either by the way.
(This code uses automatic properties see reference: private field members are generated for the Title,Author,ISBN and public properties for get/set)
Hope that helps!
Upvotes: 0
Reputation: 1714
They wish you to create a class with 4 properties (which are private -
) and two methods (which are public +
).
Upvotes: 1
Reputation: 41138
That means the class name is Book.
It has private fields that are Title, Author First Name, Author Last Name and ISBN Number.
It also has public methods called checkOut and checkIn.
In UML + means public, and - means private.
Upvotes: 3