Explanation of Solution
Given: The mail-system project.
To find: The steps to create an object of class MailServer and then create two objects of class MailClient and set the name of instance as sophie and juan. The name of the user in the MailClient should be “Sophie� and “Juan�. After that, invoke the method named sendMailItem of Sophie’s instance in order to send the message to the user named Juan.
Solution:
In order to create an object of MailServer class, it is necessary to right click on the MailServer class and then click on new MailServer(); and then click on “ok� button.
A rectangular box will appear on BlueJ indicating that it is an object.
Similarly, an object of another class named MailClient can be created.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
- Examine the getBalance method's header and body, and then evaluate how they stack up against those of the getPrice method. I'm confused as to the differences between the two.arrow_forwardFor a parking management system, use the Observer pattern to implement this interaction using Java and implement the three classes mentioned below. Implement a ParkingObserver that has the role of the Observer. The Observable classes (Subjects) will be the ParkingLots. It would be helpful if the notify method in the subjects (and update method in the observers) took a parameter, perhaps an object of type ParkingEvent, which could have fields including the lot, timeIn, timeOut (if relevant), and permit. The ParkingObserver should register with each ParkingLot and receive the messages. Once a car enters (in an entry-scan only lot) or leaves (in an entry-scan and exit-scan lot), then the ParkingObserver will be updated, and then can register the charge with the parking system via the TransactionManager’s park() method. Based on these requirements you should implement three actor classes in this interaction using java: TransactionManager, ParkingObserver and ParkingLot. 1. The…arrow_forwardThe Contact class implements the Comparable interface and thereforeprovides a definition of the compareTo method. In this case, the contacts aresorted by last name; if two contacts have the same last name, their first namesare used.arrow_forward
- Please solve it with java and post a screenshot of the code for both classes, do not use Scanner and do not use the date packagearrow_forwardPLEASE ENSURE TO USE THE FRAMEWORK PROVIDED IN THE IMAGES, AND THAT IT WORKS WITH THE TESTER CLASS. PLEASE EDIT BOTH THE TEST CLASS, DO NOT EDIT THE MAIN METHOD. Write a BankAccountTester class whose main method constructs a bank account, deposits $1,000, withdraws $500, withdraws another $400, and then prints the remaining balance. Also print the expected result.arrow_forwardConsider a piece of online banking software that includes a hidden function that allows the developer to see the account information for any account with a balance of at least $10,000. This scenario is conceivable. If this was an assault, who knows what the repercussions may be?arrow_forward
- Complete the class LeprechaunGold to model a stash of gold coins at the end of the rainbow. There is a maximum capacity to the number of gold coins a leprechaun can store at any given time (the pot they store them in can only hold so many). The pot also holds a current amount. What does the LeprechaunGold object need to remember? Those are the instance variables. Provide a constructor that takes the maximum capacity as a parameter. The constructor initializes the instance variables (two of them). Provide methods public int getCapacity() - gets the maximum capacity public int getAmount() - gets the number of coins in the pot public void donate(int coins) - simulates making a donation public void save(int coins) - simulates adding more coins to the potarrow_forwardplease implement the code for password validation by considering all scenarios and run it, if it runs with the correct answer I will upvotearrow_forward1. Explain why the operation handleMessagefromServer() appears in both ObservableClient and AdaptableClient classes. Are they concrete or abstract? 2. If we want the system give a signal to the client when a message from the server is received, what should the program do? Indicate what methods will be used to implement your idea. 3. Indicate the advantages of using the Observable pattern and Adapterpattern in this design.arrow_forward
- write the java mini project and upload the code .class as like this and also provide the screenshot of the code. use these method for insert ,remove and search public boolean insertBook(Book b) { for(int i=0; i<books.length; i++) { if(books[i] == null) { books[i] = b; return true; } } return false; } public boolean removeBook(Book b) { for(int i=0; i<books.length; i++) { if(books[i].getIsbn().equalsIgnoreCase(b.getIsbn())) { for(int j=i; j<books.length-1; j++) { books[j] = books[j+1]; } return true; } } return false; } public Book searchBook(String isbn) { for(int i=0; i<books.length; i++) { if(books[i] != null) {…arrow_forwardPLEASE ENSURE TO USE THE FRAMEWORK PROVIDED IN THE IMAGES, AND THAT IT WORKS WITH THE TESTER CLASS. PLEASE DONT EDIT THE TEST CLASS. Simulate a circuit for controlling a hallway light that has switches at both ends of the hallway. Each switch can be up or down, and the light can be on or off. Toggling either switch turns the lamp on or off. Provide methods public int getFirstSwitchState() // 0 for down, 1 for up public int getSecondSwitchState()public int getLampState() // 0 for off, 1 for onpublic void toggleFirstSwitch() public void toggleSecondSwitch()arrow_forwardExperiment with different combinations of settings (breeding age, maximum age, breeding probability, litter size, etc.) for foxes and rabbits. Do species always disappear completely in some configurations? Are there configurations that are stable—i.e., that produce a balance of numbers for a significant length of time?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education