Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Wednesday, 26 October 2011

A video rental shop maintains the inventory of videotapes that are being sold in the shop. Whenever a customer wants to rent a videotape, the sales person can check through the list to find out the availability of that particular videotape. If it is not available, then certain message will be displayed. If it is available, then the system displays the details. If the customer confirms his/her choice, the system displays the price and the due date for returning the videotape by (noor diana fauzi)

import java.util.*;
class moviesforrent
{
public static void main (String args[])
{
Scanner in = new Scanner (System.in);
String mname;
System.out.print ("\n\t Enter the movie name = ");
mname=in.nextLine();
movies ob = new movies();
ob.pricendetail(mname);
}
}

class movies
{
String ma[] = new String [4];
String mc[] = new String [4];
//price per week=RM10.
movies()
{
ma[0]="fast&furious";
ma[1]="pearl harbor";
ma[2]="death note";
ma[3]="ratatouille";

mc[0]="Josh Hartnett";
mc[1]="Ben Affleck";
mc[2]="Michael Bays";
mc[3]="Jerry Bruckheimer";
}

void pricendetail(String mname)
{
int i=0,j=0;
while (i<4)
{
if (mname.equals(ma[i]))
{
System.out.println ("\n\t Movie: "+mname+" \n\t Main character: "+mc[i]+"\n\t Price per week = RM 10.00");
j=1;
break;
}
++i;
}
if (j==0)
System.out.println ("\n\t "+mname+" is not available.");
}

}

Tuesday, 25 October 2011

Java program that joins 3 strings to show the quote, the person who said that and dates he/she lived by(Adler Lawn Service, LLC)

import java.util.*;

class joinstring
{
public static void main (String args[])
{
Scanner in= new Scanner (System.in);
String quote,name,date;

System.out.print ("\n\t Enter the quote = ");
quote=in.nextLine();
System.out.print ("\n\t Enter name of the person who said this = ");
name=in.nextLine();
System.out.print ("\n\t Enter the dates that person lived \n\t (i.e. 14 September 1925 - 25 January 1995 ) = ");
date=in.nextLine();

System.out.println ("\n\n\n\t ''"+quote+"''\n\t "+name+"\n\t ("+date+")");

}
}