66 951
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #14370 in Java | JSP | JSF for asd

Question #14370
Write a Java class DVD to satisfy the following user requirements.
The main method should ask the user (with a Pop up box) to input the
Title of a Film DVD and the cost of rental for one week.
If the user inputs ( Men in Black 3, 3.99), the programme should print
out a message as follows:
The cost of the DVD Men in Black 3 for one week is : � 3.99
Expert's answer
public class DVD {

/**
* @param args
*/
public static void
main(String[] args) {

String DVD=JOptionPane.showInputDialog("Input the
title of a Film DVD and the cost of rental for one week");

String
name=DVD.substring(0, DVD.indexOf(","));
String
rental=DVD.substring(DVD.indexOf(",")+1);

System.out.println("The cost of
the DVD "+name+" for one week is:"+rental);
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions