Comsats University Islamabad
Comsats University Islamabad
Comsats University Islamabad
WAH CAMPUS
Name: Nimra safa
Roll no: SP22-BCS-049
Question 1.
package com.mycompany.account;
class account1
{
private double balance;
}
public void withdraw(int a)
{
balance = balance - a;
}
public void deposit(int c)
{
balance = balance + c;
}
}
}
}
Question 2
package com.mycompany.task2;
import java.util.Scanner;
class car
carmodel = input.nextInt();
price = input1.nextInt();
}
public void setcarname()
carname = input2.nextLine();
carowner = input3.nextLine();
}
}
class Book
title = s;
bprice = p;
noofpages = n;
{
System.out.println("The title of Book" + title);
c1.setmodel();
c1.setprice();
c1.setcarname();
c1.setcarowner();
c1.display();
c2.settitle("The PPC");
c2.setprice(300);
c2.setNoofpages(302);
c2.display();
}
Question 3:
package Task3;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
class employee{
Scanner input = new Scanner(System.in);
private int employeeCode;
private String employeeName;
private String employeeDateOfJoining;
private String CurrentDate;
if((Check/365)>3)
{
System.out.println("Tenure is more than 3 years");
}
else
{
System.out.println("Tenure is less than 3 years");
}
}
}