Hi I am writing a java program for a mobile database that should input from the user three entries (manufacturer, Model and Rating) save this in an array and file and be able to search from the data i the file and print on screen.
I have written it but i am having a difficulty writting the data in a file and searching from the file.
I would also like help in writting the pseudocode i am able to write the code but unsure of how to write the pseudocode
Kindly help
The code is
import javax.swing.JOptionPane;
public class Mobile
{
private String manufacturer;
private String model;
private int rating;
public static void print(Mobile phone)
{
JOptionPane.showMessageDialog(null,"Manufacturer: "+phone.manufacturer+"\nModel: "+phone.model+"\nRating: "+phone.rating);
}
public Mobile(String manufac, String mdl, int rtg)
{
manufacturer = manufac;
model = mdl;
rating = rtg;
}
public static void main(String[] args)
{
Mobile phone = null;
int choice = 0;
do
{
String input = JOptionPane.showInputDialog("Chose an option:\n1: Input Mobile Details\n2: Print Mobile Details\n3: Quit");
choice = Integer.parseInt(input);
switch (choice)
{
case 1 :
String manufacturer = JOptionPane.showInputDialog("Manufacturer:");
String model = JOptionPane.showInputDialog("Model:");
int rating = Integer.parseInt(JOptionPane.showInputDialog("Rating:"));
phone = new Mobile(manufacturer, model, rating);
break;
case 2:
print(phone);
break;
}
} while (choice != 3);
}
}