The purpose of this assignment is to reinforce Ada concepts. Specifically, the a
ID: 3714535 • Letter: T
Question
The purpose of this assignment is to reinforce Ada concepts. Specifically, the assignment is to:
• define a Book class where a book contains the following components: ? an author ? a title ? a number of pages
• A “main program” needs to create a book and then display its contents.
In book class have to input an author name, a title, and number of pages
print inputs and then ask for modification any of those (ex:No and Yes)
then modified print input
1 main.adb file
2. books.adb file
3. books.ads file
Explanation / Answer
class Book(){
private String bookTitle;
private Int PageCount;
private String Author;
public static void main(String args[]){
scanner s=new Scanner(System.in);
System.out.println("Enter in the title of the book :");
setTitle(s.next());
System.out.println("Enter in the Author of the book :");
setAuthor(s.next());
System.out.println("Enter in the pages of the book :");
setPageCount(s.nexttInt());
getContent();
}
public void setTitle(String title){
bookTitle=title;
}
public void setAuthor(String author){
Author=author;
}
public void setPageCount(Int pages){
PageCount=pages;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.