0% found this document useful (0 votes)
75 views

Experiment 2: Design and Implement A Simple Inventory Control System For A Small Video Rental Store

The student designed and implemented a simple inventory control system for a small video rental store in Java. The system includes Video_6116 and VideoStore_6116 classes. Video_6116 represents individual videos with attributes like title and availability, and methods like renting and returning. VideoStore_6116 manages an array of Video_6116 objects, and allows adding videos, checking videos in and out, and listing the inventory. The main class has a menu for users to interact with the system as a user or admin.

Uploaded by

Dimple Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Experiment 2: Design and Implement A Simple Inventory Control System For A Small Video Rental Store

The student designed and implemented a simple inventory control system for a small video rental store in Java. The system includes Video_6116 and VideoStore_6116 classes. Video_6116 represents individual videos with attributes like title and availability, and methods like renting and returning. VideoStore_6116 manages an array of Video_6116 objects, and allows adding videos, checking videos in and out, and listing the inventory. The main class has a menu for users to interact with the system as a user or admin.

Uploaded by

Dimple Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

EXPERIMENT 2

Student Name: Gurjot UID: 19BCS1820


Branch: CSE Section/Group: IS-7/B
Semester: 6 Date: 23/2/2022
Subject Name: Project Based Learning In JAVA Subject Code: CSP-358

AIM:
Design and implement a simple inventory control system for a small video rental store.

Tasks To Be Done:
Design and implement a simple inventory control system for a small video rental store.

Apparatus
● Any Java IDE E.g.: Eclipse, IntelliJ
● Java JDK Installed on System

CODES:

Video_6116 Class:
import java.util.Scanner; class
Video_6116 { public String
title_6116; public boolean
checked=true;
int avgrating_6116; public String
title; public boolean checked() {
return checked; } public void
rent() { checked=false; } public
void returned() { checked=true;
System.out.println("Video is returned "); } public int
getRating_6116() { if(avgrating_6116>0) {
return avgrating_6116; }
else { System.out.println("
Rating is not available");
return 0; }
}
}
VideoStore_6116 Class:
import java.util.Scanner; class VideoStore_6116 extends
Video_6116 { Video_6116 v[]=new Video_6116[10];
private String title; static int i=0; void addVideo_6116(String
title) {
v[i]=new Video_6116();
this.title=title; v[i].title=title;
i++;
System.out.println("Video Added Successfully"); } void
checkOut_6116(String title) { for(int k=0;k<i;k++) {
if(v[k].title.equalsIgnoreCase(title)) { if(v[k].checked()) {
v[k].rent();
System.out.println("Video is rented"); } else {
System.out.println("Sorry Video not available"); }
}
}
}
void returnVideo_6116(String title) { if(i==0) {
System.out.println("You have no video to return"); } for(int
k=0;k<i;k++) { if(v[k].title.equalsIgnoreCase(title)) {
v[k].checked=true; }
}
}
public void receiveRating_6116() { if(i==0) {
System.out.println("No Video inInventory"); } else { for(int
k=0;k<i;k++) {
System.out.println("Enter the rating for movie"+v[k].title);
@SuppressWarnings("resource") Scanner ob=new
Scanner(System.in); v[k].avgrating_6116=ob.nextInt(); }
}
}
public void listInventory_6116() { if(i==0) {
System.out.println("No Video in Inventory"); } else {
for(int k=0;k<i;k++) {
System.out.println(k+1 +". "+v[k].title+" "+"Rating "+ v[k].avgrating_6116 +
"Availability"+v[k].checked()); }
}
}
}

Main_6116 Class:
import java.util.Scanner; public class Main_6116 { public
static void main(String[] args) {
VideoStore_6116 vs=new VideoStore_6116(); int
ch,uCh,aCh,vno; String title,choice; do {
System.out.println("=========Menu=========");
System.out.println("1. Login as User");
System.out.println("2. Login as Admin");
System.out.println("Enter Your Choice"); Scanner s=new
Scanner(System.in); ch=s.nextInt(); do { switch(ch) {
case 1: System.out.println("1. List Inventory");
System.out.println("2. Rent Video");
System.out.println("3. Enter the rating of Video");
System.out.println("4. Return Video"); uCh=s.nextInt();
if(uCh==1) { vs.listInventory_6116(); } else if(uCh==2) {
vs.listInventory_6116();
System.out.println("Enter the video Name you want");
title=s.next(); vs.checkOut_6116(title); } else if(uCh==3) {
vs.receiveRating_6116(); } else if(uCh==4) { vs.rent(); }
else {
System.out.println("No such Option is available"); } break;
case 2:
System.out.println("1. List Inventory");
System.out.println("2. Add Video");
aCh=s.nextInt(); if(aCh==1) {
vs.listInventory_6116(); } if(aCh==2) {
System.out.println("Enter the name of Video");
title=s.next(); vs.addVideo_6116(title); }
break; default:System.out.println("Sorry Wrong Choice"); }
System.out.println("Do you want to repeat yes/no");
choice=s.next(); }
while(choice.equalsIgnoreCase("yes"));
System.out.println("Want to Return to main Menu yes/no"); choice=s.next(); }
while(choice.equalsIgnoreCase("yes")); }
}
LEARNING OUTCOMES:
1. Learned how to use else if ladder in Java
2. Learned how to use inheritance to make a management system
3. Learned how to use boolean values in Java
4. Learned how to make a menu driven program

Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):

Sr. No. Parameters Marks Obtained Maximum Marks


1.
2.
3.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy