Question
using java Q5. Open the codepad in Bluej and try the following statements. Write the results achieved. a) Java Programming: + 123 b) 27 %
using java
Q5. Open the codepad in Bluej and try the following statements. Write the results achieved.
a) Java Programming: + 123
b) 27 % 4
c) xyz + abc
Q6. Write a method ListAllStudent() from a university Collection.
Hint: Use for each loop
Q7. Draw Class Diagram and Object Diagram from the below given Details.
public class Car
{
private Sedan Model;
private Sedan Price;
}
Q8. Write a declaration of a private field named Department that can hold an ArrayList. The elements of the ArrayList are of type University. Write an assignment to the Department variable to create an appropriate ArrayList objects.
Q9. Create a class MapTester and use HashMap to implement a phonebook
given below:
HashMapphoneBook = new HashMap ();
phoneBook.put("Homer Jay Simpson", "(531) 9392 4587"); phoneBook.put("Charles Montgomery Burns", "(531) 5432 1945"); phoneBook.put("Apu Nahasapeemapetilon", "(531) 4234 4418");
Q10. In the HashMap class, implement two methods : public void enterNumber(String name, String number) and
public String lookupNumber(String name)
The methods should use the put and get methods of the HashMap class to implement their functionality.
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