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

LabExp1

The document contains two Java programs: the first is an Inventory Management System for a Warehouse that calculates total inventory value based on user input, and the second is a Smart Electricity Billing System that computes the total bill for customers based on their electricity consumption. Both programs utilize the Scanner class for user input and involve basic array manipulations. The code snippets provided contain some syntax errors and formatting issues that need to be addressed for proper execution.

Uploaded by

unstableathu
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)
3 views

LabExp1

The document contains two Java programs: the first is an Inventory Management System for a Warehouse that calculates total inventory value based on user input, and the second is a Smart Electricity Billing System that computes the total bill for customers based on their electricity consumption. Both programs utilize the Scanner class for user input and involve basic array manipulations. The code snippets provided contain some syntax errors and formatting issues that need to be addressed for proper execution.

Uploaded by

unstableathu
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/ 3

Sanjeev Yalgati CMPN-B 24102B0043

Object Oriented Programming


Lab Experiment
Problem 1

1. Inventory Management System for a Warehouse

import java.util.Scanner;

public class Main

public static void main(String arg[])

Scanner sc = new Scanner(System.in);

int m,n,i,j;

System.out.println("Enter the size of ware hows tem resp: ");

m=sc.nextInt();

n=3;

int warehouse[][]= new int[m][n];

System.out.println("Enter the data: ");

for( i=0; i<n; ++i)

for( j=0;j<n; ++j)

warehouse[i][j]= sc.nextInt();

int sum= 0;
Sanjeev Yalgati CMPN-B 24102B0043

for( i=0; i<n;i++)

sum+= warehouse[i][2]*warehouse[i][1];

System.out.println("Item ID: "+warehouse[1][0]+" "+"Quantity: "+warehouse[i][1]+" "+"Value:


"+warehouse [1] [2] *warehouse[i][1]+"rs");

System.out.println("Total Inverntory value is: "+ sum+"rs");

sc.close();

2.Smart Electricity Billing System

import java.util.Scanner;

public class assla ( public static void main(String []arg){

Scanner sc new Scanner(System.in);

int n;

System.out.println("Enter no. of customer");

n=sc.nextInt();

int customer[]= new int[n];

int units new int [n];

int cost[]= new int[n];

System.out.println("Enter customer ID and units consumed by him");

for(int i=0; 1 < n; i++)

customer[i]sc.nextInt();
Sanjeev Yalgati CMPN-B 24102B0043

units[i]= sc.nextInt();

if(units[i]<100)( cost[1]-3 units[i];

else if(units[1]300)

{cost[1]= 3(180)+5*(units[1]-100);}

else if {

cost[1]= 3(100)+5*(260)+8*(units[i]-300);

} for(int 16:1<n;++i)

System.out.println("Customer ID: "customer [1]+" "+"Units: "units[i]+" "+"Total bill: "*cost[i]+"rs");

sc.close();

You might also like