Question
Code is in Java, Create a java file and a xml file, this is an android studio assignment . I need help implementing this test
Code is in Java, Create a java file and a xml file, this is an android studio assignment . I need help implementing this test case
{Display Main Menu}
- The use case begins when the System prompts the Customer with options of CreateAccount, Place Hold, and Manage System.
- The Customer selects the Place Hold option.
{Enter Genre}
- The System prompts the Customer to select a genre from the following: Computer Science, Fiction, Memoir.
{Select Book}
- Based on the genre selected by the Customer, the System displays all books available for the reservation. In our case, we assume that there are three books in the library as below when the System starts:
Book Title | Author | Genre |
A Heartbreaking Work of Staggering Genius | Dave Eggers | Memoir |
The IDA Pro Book | Chris Eagle | Computer Science |
Frankenstein | Mary Shelley | Fiction |
- The Customer picks a book that they would like to check out.
{Login to System}
- The System prompts the Customer to enter their username and password.
- The Customer enters their username and password.
- The System confirms that the Customer information is valid.
{Confirmation}
- The System displays the Customer username, book title, and reservation number.
(10) The System prompts the Customer if the information is correct.
(11) The Customer indicates that the information is correct.
{Log the Transaction}
(12) The System records the transaction information that includes a transaction type (= Place Hold), the customer username, and a reservation number.
{Use Case Ends}
(13) The System displays the main menu.
(14) The use case ends.
Here is my LibraryDao
@Dao public interface LibraryDao { @Insert void CreateBook(Library library); @Query("SELECT * FROM LibraryDB") List
@Entity(tableName = "LibraryDB") public class Library { @PrimaryKey(autoGenerate = true) private int id; @ColumnInfo(name ="BookTitle") private String BookTitle; @ColumnInfo(name = "Author") private String Author; @ColumnInfo (name = "Genre") private String Genre; public Library( String BookTitle, String Author, String Genre) { this.BookTitle = BookTitle; this.Author = Author; this.Genre = Genre; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getBookTitle() { return BookTitle; } public void setBookTitle(String bookTitle) { BookTitle = bookTitle; } public String getAuthor() { return Author; } public void setAuthor(String author) { Author = author; } public String getGenre() { return Genre; } public void setGenre(String genre) { Genre = genre; } @Override public String toString() { return "Library{" + "id=" + id + ", BookTitle='" + BookTitle + '\'' + ", Author='" + Author + '\'' + ", Genre='" + Genre + '\'' + '}'; } } Here is my Database
@Database(entities = {Accounts.class,Library.class},version = 5,exportSchema = false) public abstract class ProjectDatabase extends RoomDatabase { public abstract AccountsDao accounts(); public abstract LibraryDao library(); private static ProjectDatabase sInstance; public static synchronized ProjectDatabase getInstance(Context context){ if(sInstance == null){ sInstance= Room.databaseBuilder(context.getApplicationContext(), ProjectDatabase.class,"Project.db") .fallbackToDestructiveMigration() .allowMainThreadQueries() .build(); } return sInstance; } public void populateAccountData(){ if(accounts().count()==0){ runInTransaction(()->{ //Added default users Accounts act1= new Accounts("hShuard","m@thl3t3"); accounts().CreateUser(act1); accounts().CreateUser(new Accounts("bMishra","bioN@no")); accounts().CreateUser(new Accounts("shirleyBee","Carmel2Chicago")); accounts().CreateUser(new Accounts("!admin2","!admin2")); }); } if(library().count()==0){ runInTransaction(()->{ Library books= new Library("A Heartbreaking Work of Staggering Genius","Dave Eggers","Memoir"); library().CreateBook(books); library().CreateBook(new Library("The IDA Pro Book","Chris Eggers","Computer Science")); library().CreateBook(new Library("Frankenstein","Mary Shelley","Fiction")); }); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started