# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService {

String car_type;

double km,bill;

CabService(){

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept(){

Scanner inp = new Scanner(System.in);

System.out.println("Enter Car Type:");

car_type = inp.nextLine();

System.out.println("Enter Distance:");

km = inp.nextDouble();

}

void calculate(){

if(car_type.equalsIgnoreCase("AC")){

if(km<=5){

bill = 150;

}

else {

bill = 150 + (km-5)*10;

}

}

else {

if(km<=5){

bill = 120;

}

else {

bill = 120 + (km-5)*8;

}

}

}

void display(){

System.out.println("CAR TYPE: " +car_type);

System.out.println("KILOMETRES TRAVELLED: " +km);

System.out.println("TOTAL BILL: " +bill);

}

void main (){

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

Scanner sc=new Scanner(System.in);

String car_type;

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter Kilometres travelled");

bill=sc.nextDouble();

}

void calculate()

{

if (car_type.equalsIgnoreCase(("AC CAR"))&& (km<=5))

bill=150;

else if (car_type.equalsIgnoreCase(("AC CAR"))&& (km>5))

bill=150+((km-5)*10);

else if (car_type.equalsIgnoreCase(("Non AC CAR"))&& (km<=5))

bill=120;

else if (car_type.equalsIgnoreCase(("Non AC CAR"))&& (km<=5))

bill=120+((km-5)*8);

}

void display()

{

System.out.println("CAR TYPE=" +car_type);

System.out.println("KILOMETER TRAVELLED=" +km);

System.out.println("TOTAL BILL=" +bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

Scanner sc=new Scanner(System.in);

String car_type="";

double km , bill=0.0;

void accept()

{

System.out.println("Enter Distance Travelled in kms");

km=sc.nextDouble();

System.out.println("Enter Car Type");

car_type=sc.next();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<=5)

{

bill=150;

}

else

{

bill=150+(km-5)*10;

}

}

else if(car_type.equalsIgnoreCase("NON AC"))

{

if(km<=5)

{

bill=120;

}

else

{

bill=120+(km-5)*8;

}

}

else

{

System.out.println("Wrong Input");

}

}

void display()

{

System.out.println("CAR TYPE: "+car_type);

System.out.println("DISTANCE: "+km);

System.out.println("BILL: "+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km,bill=0;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter km");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC")&&(km<=5))

bill=150;

else if(car_type.equalsIgnoreCase("AC")&&(km>5))

bill=150+(km-5)*10;

else if(car_type.equalsIgnoreCase("Non AC")&&(km<=5))

bill=120;

else if(car_type.equalsIgnoreCase("Non AC")&&(km>5))

bill=120+(km-5)*8;

}

void display()

{

System.out.println("CAR TYPE :" +car_type);

System.out.println("KILOMETER TRAVELLED :" +km);

System.out.println("TOTAL BILL :" +bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService2

{

String car_type;

double km;

double bill;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if(km<=5)

{

if(car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else

{

if(car_type.equals("AC"))

bill=150+10*(km-5);

else

bill=120+8*(km-5);

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if(km<=5)

{

if(car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else

{

if(car_type.equals("AC"))

bill=150+10*(km-5);

else

bill=120+8*(km-5);

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService() {

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = in.nextLine();

System.out.print("Enter kilometer: ");

km = in.nextDouble();

}

void calculate() {

if (km <= 5) {

if (car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else {

if (car_type.equals("AC"))

bill = 150 + 10 * (km - 5);

else

bill = 120 + 8 * (km - 5);

}

}

void display() {

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main() {

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*; class RailwayTicket { String name; String coach; long mobno; int amt; int totalamt; void accept() { Scanner sc = new Scanner(System.in); System.out.print("Enter name: "); name = sc.nextLine(); System.out.print("Enter coach: "); coach = sc.nextLine(); System.out.print("Enter mobile no: "); mobno = sc.nextLong(); System.out.print("Enter amount: "); amt = sc.nextInt(); } void update() { if(coach.equalsIgnoreCase("First_AC")) totalamt = amt + 700; else if(coach.equalsIgnoreCase("Second_AC")) totalamt = amt + 500; else if(coach.equalsIgnoreCase("Third_AC")) totalamt = amt + 250; else if(coach.equalsIgnoreCase("Sleeper")) totalamt = amt; } void display() { System.out.println("Name: " + name); System.out.println("Coach: " + coach); System.out.println("Total Amount: " + totalamt); System.out.println("Mobile number: " + mobno); } static void main() { RailwayTicket obj = new RailwayTicket(); obj.accept(); obj.update(); obj.display(); } }

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type=" ";

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter your car type(AC or NON AC)");

car_type=sc.nextLine();

System.out.println("Enter kilometer travelled");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<=5)

bill=150;

else

bill=150+(km-5)*10;

}

else

{

if(km<=5)

bill=120;

else

bill=120+(km-5)*8;

}

}

void display()

{

System.out.println("CAR TYPE: "+car_type);

System.out.println("KILOMETER TRAVELLED: "+km);

System.out.println("TOTAL BILL: "+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.Scanner;

public class CabService

{

String car_type;

double km;

double bill;

public CabService() {

car_type = "";

km = 0.0;

bill = 0.0;

}

public void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = in.nextLine();

System.out.print("Enter kilometer: ");

km = in.nextDouble();

}

public void calculate() {

if (km <= 5) {

if (car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else {

if (car_type.equals("AC"))

bill = 150 + 10 * (km - 5);

else

bill = 120 + 8 * (km - 5);

}

}

public void display() {

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

public static void main(String args[]) {

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km,bill=0;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter km");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC")&&(km<=5))

bill=150;

else if(car_type.equalsIgnoreCase("AC")&&(km>5))

bill=150+(km-5)*10;

else if(car_type.equalsIgnoreCase("Non AC")&&(km<=5))

bill=120;

else if(car_type.equalsIgnoreCase("Non AC")&&(km>5))

bill=120+(km-5)*8;

}

void display()

{

System.out.println("CAR TYPE :" +car_type);

System.out.println("KILOMETER TRAVELLED :" +km);

System.out.println("TOTAL BILL :" +bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type(AC or NON AC)");

car_type=sc.nextLine();

System.out.println("Enter Kilometer Travelled");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<5)

{

bill=150;

}

if (km>5)

{

bill=150+(km-5)*10;

}}

else if(car_type.equalsIgnoreCase("NON AC"))

{

if(km<5)

{

bill=120;

}

if(km>5)

{

bill=120+(km-5)*8;

}

}

}

void display()

{

System.out.println("CAR TYPE:"+car_type);

System.out.println("KILOMETER TRAVELLED:"+km);

System.out.println("TOTAL BILL:"+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}}

# data[].attributes.body
import java.util.*;

class CabService {

String car_type;

double km,bill;

Journal1(){

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept(){

Scanner inp = new Scanner(System.in);

System.out.println("Enter Car Type:");

car_type = inp.nextLine();

System.out.println("Enter Distance:");

km = inp.nextDouble();

}

void calculate(){

if(car_type.equalsIgnoreCase("AC")){

if(km<=5){

bill = 150;

}

else {

bill = 150 + (km-5)*10;

}

}

else {

if(km<=5){

bill = 120;

}

else {

bill = 120 + (km-5)*8;

}

}

}

void display(){

System.out.println("CAR TYPE: " +car_type);

System.out.println("KILOMETRES TRAVELLED: " +km);

System.out.println("TOTAL BILL: " +bill);

}

void main (){

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService() {

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = in.nextLine();

System.out.print("Enter kilometer: ");

km = in.nextDouble();

}

void calculate() {

if (km <= 5) {

if (car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else {

if (car_type.equals("AC"))

bill = 150 + 10 * (km - 5);

else

bill = 120 + 8 * (km - 5);

}

}

void display() {

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main() {

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type=" ";

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter your car type(AC or NON AC)");

car_type=sc.nextLine();

System.out.println("Enter kilometer travelled");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<=5)

bill=150;

else

bill=150+(km-5)*10;

}

else

{

if(km<=5)

bill=120;

else

bill=120+(km-5)*8;

}

}

void display()

{

System.out.println("CAR TYPE: "+car_type);

System.out.println("KILOMETER TRAVELLED: "+km);

System.out.println("TOTAL BILL: "+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService(){

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter Distance in km");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

if(km<=5)

{

bill=150;

}

else

{

bill=150+(km-5)*10;

}

else

{

if(km<=5)

{

bill=120;

}

else

{

bill=120+(km-5)*8;

}

}

}

void display()

{

System.out.println("Car type"+car_type);

System.out.println("Kilometre Travelled="+km);

System.out.println("Bill"+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class J1

{

String car_type;

double km;

double bill;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if(km<=5)

{

if(car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else

{

if(car_type.equals("AC"))

bill=150+10*(km-5);

else

bill=120+8*(km-5);

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

J1 obj = new J1();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type=" ";

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter your car type(AC or NON AC)");

car_type=sc.nextLine();

System.out.println("Enter kilometer travelled");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<=5)

bill=150;

else

bill=150+(km-5)*10;

}

else

{

if(km<=5)

bill=120;

else

bill=120+(km-5)*8;

}

}

void display()

{

System.out.println("CAR TYPE: "+car_type);

System.out.println("KILOMETER TRAVELLED: "+km);

System.out.println("TOTAL BILL: "+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
public class Overload

{

void Number(int num, int d) {

int f = 0;

while (num != 0) {

int x = num % 10;

if (x == d) {

f++;

}

num /= 10;

}

System.out.println("Frequency of digit " + d + " = " + f);

}

void Number(int n1) {

int s = 0;

while (n1 != 0) {

int x = n1 % 10;

if (x % 2 == 0) {

s = s + x;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + s);

}

public static void main(String args[]) {

Overload obj = new Overload();

obj.Number(2565685, 5);

obj.Number(29865);

}

}

# data[].attributes.body
import java.util.Scanner;

public class CabService
{
    String car_type;
    double km;
    double bill;

    public CabService() {
        car_type = "";
        km = 0.0;
        bill = 0.0;
    }

    public void accept() {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter car type: ");
        car_type = in.nextLine();
        System.out.print("Enter kilometer: ");
        km = in.nextDouble();
    }

    public void calculate() {
        if (km <= 5) {
            if (car_type.equals("AC"))
                bill = 150;
            else
                bill = 120;
        }
        else {
            if (car_type.equals("AC"))
                bill = 150 + 10 * (km - 5);
            else
                bill = 120 + 8 * (km - 5);
        }
    }

    public void display() {
        System.out.println("Car Type: " + car_type);
        System.out.println("Kilometer Travelled: " + km);
        System.out.println("Total Bill: " + bill);
    }

    public static void main(String args[]) {
        CabService obj = new CabService();
        obj.accept();
        obj.calculate();
        obj.display();
    }
}

# data[].attributes.body
Q1

import java.util.*;

class CabService

{

String car_type=" ";

double km;

double bill;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter your car type(AC or NON AC)");

car_type=sc.nextLine();

System.out.println("Enter kilometer travelled");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC"))

{

if(km<=5)

bill=150;

else

bill=150+(km-5)*10;

}

else

{

if(km<=5)

bill=120;

else

bill=120+(km-5)*8;

}

}

void display()

{

System.out.println("CAR TYPE: "+car_type);

System.out.println("KILOMETER TRAVELLED: "+km);

System.out.println("TOTAL BILL: "+bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class number

{

void Number(int num, int d)

{

int count=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

count++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+ "="+count);

}

void Number(int n1) {

int sum = 0;

while (n1>0) {

int digit = n1 % 10;

if (digit % 2 == 0) {

sum+=digit;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + sum);

}

void Number()

{

for(int i=1; i<=5; i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(i);

}

System.out.println();

}

}

void main()

{

number obj=new number();

obj.Number(2565685,5);

obj.Number();

}

}

# data[].attributes.body
Shaurya Purohit

import java.util.*;

class j1

{

String car_type;

double km;

double bill;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if(km<=5)

{

if(car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else

{

if(car_type.equals("AC"))

bill=150+10*(km-5);

else

bill=120+8*(km-5);

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService {

String car_type;

double km,bill;

CabService(){

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept(){

Scanner inp = new Scanner(System.in);

System.out.println("Enter Car Type:");

car_type = inp.nextLine();

System.out.println("Enter Distance:");

km = inp.nextDouble();

}

void calculate(){

if(car_type.equalsIgnoreCase("AC")){

if(km<=5){

bill = 150;

}

else {

bill = 150 + (km-5)*10;

}

}

else {

if(km<=5){

bill = 120;

}

else {

bill = 120 + (km-5)*8;

}

}

}

void display(){

System.out.println("CAR TYPE: " +car_type);

System.out.println("KILOMETRES TRAVELLED: " +km);

System.out.println("TOTAL BILL: " +bill);

}

void main (){

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class Number

{

void Number(int num,int d)

{

int f = 0;

while (num != 0) {

int x = num % 10;

if (x == d) {

f++;

}

num /= 10;

}

System.out.println("Frequency of digit " + d + " = " + f);

}

void Number(int n1)

{

int s = 0;

while (n1 != 0)

{

int x = n1 % 10;

if (x % 2 == 0)

{

s = s + x;

}

n1 /= 10;

}

System.out.println("Sum = "+s);

}

void Number()

{

for (int i = 1; i <= 5; i++)

{

for (int j = 1; j <= i; j++)

{

System.out.print(i + " ");

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService()

{

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if (km <= 5)

{

if (car_type.equals("AC"))

{

bill = 150;

}

else

{

bill = 120;

}

}

else

{

if (car_type.equals("AC"))

{

bill = 150 + 10 * (km - 5);

}

else

{

bill = 120 + 8 * (km - 5);

}

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
public class Overload

{

void Number(int num, int d) {

int dig,c = 0;

while (num != 0)

{

int dig = num % 10;

if(dig == d) {

c++;

}

num =num/10;

}

System.out.println("No.of " + d + " = " + c);

}

void Number(int n1) {

int s = 0;

while (n1 != 0) {

int dig = n1 % 10;

if (dig% 2 == 0) {

s = s + dig;

}

n1 /= 10;

}

System.out.println("Sum of even numbers = " + s);

}

Void Number()

{

for(int k=1;k<=5;k++)

{

for (int p=1;p<=k;p++)

{

System.out.print(k);

}System.out.println();

}

}

public static void main(String args[]) {

Overload obj = new Overload();

obj.Number(2565685, 5);

obj.Number(29865);

}

}

# data[].attributes.body
import java.util.*;

class J3

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

J3 obj = new J3();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class Number{

void Number(int num, int d){

int f = 0;

while(num>0){

int a = num % 10;

if(a==d){

f++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+"="+f);

}

void Number(int n1){

int s = 0;

while (n1>0){

int b = n1%10;

if(b%2==0){

s+=b;

}

n1/=10;

System.out.println("Sum of even numbers: "+s);

}

}

void Number(){

for(int i = 1; i<=5; i++)

{

for(int j = 1; j<=i; j++)

{

System.out.print(i);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class number

{

Scanner sc=new Scanner(System.in);

void Number(int num,int d)

{

int c=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

c++;

}

else

{

}

num/=10;

}

System.out.println("Frequecy of digit "+d+"="+c);

}

void Number(int n1)

{

int s=0;

while(n1>0)

{

int dig=n1%10;

if(dig%2==0)

s=s+dig;

else

n1/=10;

}

System.out.println("sum of digits= "+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km,bill=0;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter km");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC")&&(km<=5))

bill=150;

else if(car_type.equalsIgnoreCase("AC")&&(km>5))

bill=150+(km-5)*10;

else if(car_type.equalsIgnoreCase("Non AC")&&(km<=5))

bill=120;

else if(car_type.equalsIgnoreCase("Non AC")&&(km>5))

bill=120+(km-5)*8;

}

void display()

{

System.out.println("CAR TYPE :" +car_type);

System.out.println("KILOMETER TRAVELLED :" +km);

System.out.println("TOTAL BILL :" +bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class number

{

void Number(int num, int d)

{

int count=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

count++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+ "="+count);

}

void Number(int n1) {

int sum = 0;

while (n1>0) {

int digit = n1 % 10;

if (digit % 2 == 0) {

sum+=digit;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + sum);

}

void Number()

{

for(int i=1; i<=5; i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(i);

}

System.out.println();

}

}

void main()

{

number obj=new number();

obj.Number(2565685,5);

obj.Number();

}

}

# data[].attributes.body
import java.util.*;

class J4

{

void joystring(String s, char ch1, char ch2)

{

String newStr = s.replace(ch1,ch2);

System.out.println(newStr);

}

void joystring(String s)

{

int f=s.indexOf(' ');

int l=s.lastIndexOf(' ');

System.out.println("First index: " + f);

System.out.println("Last index: " + l);

}

void joystring(String s1, String s2)

{

String newStr=s1.concat(" ").concat(s2);

System.out.println(newStr);

}

static void main()

{

J4 obj = new J4();

obj.joystring("TECHNALAGY", 'A', 'O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMON WEALTH", "GAMES");

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class number

{

Scanner sc=new Scanner(System.in);

void Number(int num,int d)

{

int c=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

c++;

}

else

{

}

num/=10;

}

System.out.println("Frequecy of digit "+d+"="+c);

}

void Number(int n1)

{

int s=0;

while(n1>0)

{

int dig=n1%10;

if(dig%2==0)

s=s+dig;

else

n1/=10;

}

System.out.println("sum of digits= "+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class number

{

void Number(int num, int d)

{

int count=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

count++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+ "="+count);

}

void Number(int n1) {

int sum = 0;

while (n1>0) {

int digit = n1 % 10;

if (digit % 2 == 0) {

sum+=digit;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + sum);

}

void Number()

{

for(int i=1; i<=5; i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(i);

}

System.out.println();

}

}

void main()

{

number obj=new number();

obj.Number(2565685,5);

obj.Number();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km;

double bill;

CabService()

{

car_type = "";

km = 0.0;

bill = 0.0;

}

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if (km <= 5)

{

if (car_type.equals("AC"))

{

bill = 150;

}

else

{

bill = 120;

}

}

else

{

if (car_type.equals("AC"))

{

bill = 150 + 10 * (km - 5);

}

else

{

bill = 120 + 8 * (km - 5);

}

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class J5

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class CabService

{

String car_type;

double km,bill=0;

CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter Car Type");

car_type=sc.nextLine();

System.out.println("Enter km");

km=sc.nextDouble();

}

void calculate()

{

if(car_type.equalsIgnoreCase("AC")&&(km<=5))

bill=150;

else if(car_type.equalsIgnoreCase("AC")&&(km>5))

bill=150+(km-5)*10;

else if(car_type.equalsIgnoreCase("Non AC")&&(km<=5))

bill=120;

else if(car_type.equalsIgnoreCase("Non AC")&&(km>5))

bill=120+(km-5)*8;

}

void display()

{

System.out.println("CAR TYPE :" +car_type);

System.out.println("KILOMETER TRAVELLED :" +km);

System.out.println("TOTAL BILL :" +bill);

}

void main()

{

CabService obj=new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class joyString

{

void joystring(String s, char ch1, char ch2)

{

String newStr = s.replace(ch1,ch2);

System.out.println(newStr);

}

void joystring(String s)

{

int f=s.indexOf(' ');

int l=s.lastIndexOf(' ');

System.out.println("First index: " + f);

System.out.println("Last index: " + l);

}

void joystring(String s1, String s2)

{

String newStr=s1.concat(" ").concat(s2);

System.out.println(newStr);

}

static void main()

{

StringOverload obj = new StringOverload();

obj.joystring("TECHNALAGY", 'A', 'O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMON WEALTH", "GAMES");

}

}

# data[].attributes.body
import java.util.*;

class number

{

void Number(int num, int d)

{

int count=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

count++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+ "="+count);

}

void Number(int n1) {

int sum = 0;

while (n1>0) {

int digit = n1 % 10;

if (digit % 2 == 0) {

sum+=digit;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + sum);

}

void Number()

{

for(int i=1; i<=5; i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(i);

}

System.out.println();

}

}

void main()

{

number obj=new number();

obj.Number(2565685,5);

obj.Number();

}

}

# data[].attributes.body
import java.util.*;

class IncomeTax

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class p4

{

String car_type;

double km,bill;

void CabService()

{

car_type="";

km=0.0;

bill=0.0;

}

void accept()

{

Scanner sc=new Scanner (System.in);

System.out.println("Enter car type,km");

car_type=sc.nextLine();

km=sc.nextDouble();

}

void calculate()

{

if (car_type.equalsIgnoreCase("AC"))

{

if (km<=5)

{

bill=150;

}

else

{

bill=150+(10*km);

}}

else if (car_type.equalsIgnoreCase("NON AC"))

if (km<=5)

{

bill=120;

}

else {

bill=120+(8*km);

}}

void display()

{

System.out.println("Cartype:"+car_type);

System.out.println("bill:"+bill);

}

void main()

{

p4 obj=new p4();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class J6

{

void series()

{

int k,sum=0;

for(k=1;k<=20;k++)

{

int term = (int)Math.pow(2,k);

if (k%2==0)

sum-= term;

else

sum+= term;

}

System.out.println("Sum=" + sum);

}

void series(int n)

{

int k,term=1;

for(k=1;k<=10;k++)

{

System.out.print(term + ", ");

term =term*10+1;

}

}

}

# data[].attributes.body
import java.util.*;

class number

{

void Number(int num, int d)

{

int count=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

count++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+ "="+count);

}

void Number(int n1) {

int sum = 0;

while (n1>0) {

int digit = n1 % 10;

if (digit % 2 == 0) {

sum+=digit;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + sum);

}

void Number()

{

for(int i=1; i<=5; i++)

{

for(int j=1;j<=i;j++)

{

System.out.print(i);

}

System.out.println();

}

}

void main()

{

number obj=new number();

obj.Number(2565685,5);

obj.Number();

}

}

# data[].attributes.body
import java.util.*;

class series

{

void series()

{

int k,sum=0;

for(k=1;k<=20;k++)

{

int term = (int)Math.pow(2,k);

if (k%2==0)

sum-= term;

else

sum+= term;

}

System.out.println("Sum=" + sum);

}

void series(int n)

{

int k,term=1;

for(k=1;k<=10;k++)

{

System.out.print(term + ", ");

term =term*10+1;

}

}

}

# data[].attributes.body
import java.util.*;

class Program2{

void Number(int num,int d){

int c = 0;

while(num>0){

int n = num%10;

if(n==d){

c++;

}

num /= 10;

}

System.out.println("Frequency of "+d+" is "+c);

}

void Number(int n1){

int sum = 0;

while(n1>0){

int r = n1%10;

if(r%2==0){

sum +=r;

}

n1 /= 10;

}

System.out.println("Sum of even digits = "+sum);

}

void Number (){

for(int i=1;i<=5;i++){

for(int j=1;j<=i;j++){

System.out.print(i);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class overload

{

void Number(int num, int d)

{

int div, c=0;

while(num!=0)

{

div=num%10;

if(div==d)

c++;

num=num/10;

}

System.out.println("Frequency of the digit is "+c);

}

void Number(int n1)

{

int div, sum=0;

while(n1!=0)

{

div=n1%10;

if(div%2==0)

sum=sum+div;

n1=n1/10;

}

System.out.println("Sum of even digits = "+sum);

}

void Number()

{

int k, p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k+" ");

}

System.out.println();

}

}

}

# data[].attributes.body
Shaurya Purohit

import java.util.*;

class j1

{

String car_type;

double km;

double bill;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter car type: ");

car_type = sc.nextLine();

System.out.print("Enter kilometer: ");

km = sc.nextDouble();

}

void calculate()

{

if(km<=5)

{

if(car_type.equals("AC"))

bill = 150;

else

bill = 120;

}

else

{

if(car_type.equals("AC"))

bill=150+10*(km-5);

else

bill=120+8*(km-5);

}

}

void display()

{

System.out.println("Car Type: " + car_type);

System.out.println("Kilometer Travelled: " + km);

System.out.println("Total Bill: " + bill);

}

static void main()

{

CabService obj = new CabService();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class joyString

{

void joystring(String s, char ch1, char ch2)

{

String newStr = s.replace(ch1,ch2);

System.out.println(newStr);

}

void joystring(String s)

{

int f=s.indexOf(' ');

int l=s.lastIndexOf(' ');

System.out.println("First index: " + f);

System.out.println("Last index: " + l);

}

void joystring(String s1, String s2)

{

String newStr=s1.concat(" ").concat(s2);

System.out.println(newStr);

}

static void main()

{

StringOverload obj = new StringOverload();

obj.joystring("TECHNOLOGY", 'A', 'O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMON WEALTH", "GAMES");

}

}

# data[].attributes.body
import java.util.*;

class Volumeoverload

{

double volume(double r)

{

double vol=(4/3.0)*(22/7.0)*r*r*r;

return vol;

}

double volume(double h, double r)

{

double vol=(22/7.0)*r*r*h;

return vol;

}

double volume(double l, double b, double h)

{

double vol=l*b*h;

return vol;

}

static void main()

{

Volumeoverload obj = new Volumeoverload();

System.out.println("Sphere Volume = " + obj.volume(6));

System.out.println("Cylinder Volume = " + obj.volume(5, 3.5));

System.out.println("Cuboid Volume = " + obj.volume(7.5, 3.5, 2));

}

}

# data[].attributes.body
import java.util.*;

class IncomeTax

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

public class Overload

{

void Number(int num, int d) {

int f = 0;

while (num != 0) {

int x = num % 10;

if (x == d) {

f++;

}

num /= 10;

}

System.out.println("Frequency of digit " + d + " = " + f);

}

void Number(int n1) {

int s = 0;

while (n1 != 0) {

int x = n1 % 10;

if (x % 2 == 0) {

s = s + x;

}

n1 /= 10;

}

System.out.println("Sum of even digits = " + s);

}

public static void main(String args[]) {

Overload obj = new Overload();

obj.Number(2565685, 5);

obj.Number(29865);

}

}

# data[].attributes.body
import java.util.*;

class series

{

void series()

{

int k,sum=0;

for(k=1;k<=20;k++)

{

int term = (int)Math.pow(2,k);

if (k%2==0)

sum-= term;

else

sum+= term;

}

System.out.println("Sum=" + sum);

}

void series(int n)

{

int k,term=1;

for(k=1;k<=10;k++)

{

System.out.print(term + ", ");

term =term*10+1;

}

}

}

# data[].attributes.body
import java.util.*;

class Number{

void Number(int num, int d){

int f = 0;

while(num>0){

int a = num % 10;

if(a==d){

f++;

}

num/=10;

}

System.out.println("Frequency of digit "+d+"="+f);

}

void Number(int n1){

int s = 0;

while (n1>0){

int b = n1%10;

if(b%2==0){

s+=b;

}

n1/=10;

System.out.println("Sum of even numbers: "+s);

}

}

void Number(){

for(int i = 1; i<=5; i++)

{

for(int j = 1; j<=i; j++)

{

System.out.print(i);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class Numoverload

{

int f, s, d1, k , i ;

void Number(int num , int d )

{

f=0;

while(num!=0)

{

d1=num%10;

if(d==d1)

{

f=f+1;

}

num=num/10;

}

System.out.println("Number of times " +d +"appears " +f);

}

void Number(int n1 )

{

while(n1!=0)

{

d1=n1%10;

if(d1%2==0)

{

s=s+d1;

n1=n1/10;

}

}

System.out.println("sum of the digits = " +s);

}

void Number()

{

for (k=1 ; k<=5;k++)

{

for (i=1;i<=k;i++)

{

System.out.println(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept(){

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display() {

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class VolumeOverload

{

double volume(double r)

{

double vol=(4/3.0)*(22/7.0)*r*r*r;

return vol;

}

double volume(double h, double r)

{

double vol=(22/7.0)*r*r*h;

return vol;

}

double volume(double l, double b, double h)

{

double vol=l*b*h;

return vol;

}

static void main()

{

Volumeoverload obj = new Volumeoverload();

System.out.println("Sphere Volume = " + obj.volume(6));

System.out.println("Cylinder Volume = " + obj.volume(5, 3.5));

System.out.println("Cuboid Volume = " + obj.volume(7.5, 3.5, 2));

}

}

# data[].attributes.body
Shaurya Purohit q3

import java.util.*;

class j3

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

j3 obj = new j3();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.Scanner;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter name: ");

name = in.nextLine();

System.out.print("Enter coach: ");

coach = in.nextLine();

System.out.print("Enter mobile no: ");

mobno = in.nextLong();

System.out.print("Enter amount: ");

amt = in.nextInt();

}

void update() {

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display() {

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main() {

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class number

{

Scanner sc=new Scanner(System.in);

void Number(int num,int d)

{

int c=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

c++;

}

else

{

}

num/=10;

}

System.out.println("Frequecy of digit "+d+"="+c);

}

void Number(int n1)

{

int s=0;

while(n1>0)

{

int dig=n1%10;

if(dig%2==0)

s=s+dig;

else

n1/=10;

}

System.out.println("sum of digits= "+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class Numoverload

{

int f, s, d1, k , i ;

void Number(int num , int d )

{

f=0;

while(num!=0)

{

d1=num%10;

if(d==d1)

{

f=f+1;

}

num=num/10;

}

System.out.println("Number of times " +d +"appears " +f);

}

void Number(int n1 )

{

while(n1!=0)

{

d1=n1%10;

if(d1%2==0)

{

s=s+d1;

n1=n1/10;

}

}

System.out.println("sum of the digits = " +s);

}

void Number()

{

for (k=1 ; k<=5;k++)

{

for (i=1;i<=k;i++)

{

System.out.println(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class frequency

{

void Number(int num,int d)

{

int dig,c=0;

while(num!=0)

{

dig=num%10;

if(dig==d)

c++;

num=num/10;

}

System.out.println("No. of "+d+"= "+c);

}

void Number(int n1)

{

int s=0;

while(n1!=0)

{

int dig=n1%10;

if(dig%2==0)

s=s+dig;

n1=n1/10;

}

System.out.println("Sum of even numbers= "+s);

}

void Number()

{

for(int k=1;k<=5;k++)

{

for(int p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter your name");

name=sc.nextLine();

System.out.println("Enter the type of coach you want to travel");

coach=sc.nextLine();

System.out.println("Enter your mobile number");

mobno=sc.nextLong();

System.out.println("Enter the amount of ticket");

amt=sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt=amt+700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt=amt+500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt=amt+250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt=amt;

System.out.println("Please enter correct coach type");

}

void display()

{

System.out.println("Name: "+name);

System.out.println("Type of coach: "+coach);

System.out.println("Mobile number: "+mobno);

System.out.println("Total amount: "+totalamt);

}

void main()

{

RailwayTicket obj=new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.Scanner;

public class RailwayTicket

{

private String name;

private String coach;

private long mobno;

private int amt;

private int totalamt;

private void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter name: ");

name = in.nextLine();

System.out.print("Enter coach: ");

coach = in.nextLine();

System.out.print("Enter mobile no: ");

mobno = in.nextLong();

System.out.print("Enter amount: ");

amt = in.nextInt();

}

private void update() {

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

private void display() {

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

public static void main(String args[]) {

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class IncomeTax

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter name:");

name=sc.nextLine();

System.out.print("Enter coach:");

coach=sc.nextLine();

System.out.print("Enter mobile no");

mobno=sc.nextLong();

System.out.print("Enter Amount");

amt=sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt=amt+700;

if(coach.equalsIgnoreCase("Second_AC"))

totalamt=amt+500;

if(coach.equalsIgnoreCase("Third_AC"))

totalamt=amt+250;

if(coach.equalsIgnoreCase("Sleeper"))

totalamt=amt;

}

void display()

{

System.out.println("Name:"+name);

System.out.println("Coach:"+coach);

System.out.println("Totalamount:"+totalamt);

System.out.println("Mobile Number:"+mobno);

}

static void main()

{

RailwayTicket obj=new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt=0;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class Number

{

void Number(int num, int d)

{

int f=0;

for(int k=0; k<=7; k++)

{

int dig=num%10;

num/=10;

if(dig==d)

{

f++;

}

}

System.out.println("Frequency: " +f);

}

void Number(int n1)

{

int count=0;

for(int k=0; k<=5; k++)

{

int d=n1%10;

n1/=10;

if(d%2==0)

{

count+=d;

}

}

System.out.println("Sum of even digits= " +count);

}

void Number()

{

for(int i=0; i<=5; i++)

{

for(int j=0; j<=i; j++)

{

System.out.print(i);

}

System.out.println("");

}

}

static void main()

{

Number obj=new Number();

obj.Number(2565685, 5);

obj.Number(29865);

obj.Number();

}

}

# data[].attributes.body
import java.util.*;

class Q2

{

void Number(int num,int d)

{

int c=num,f=0;

while(c>0)

{

if(c%10==d)

f+=1;

c=c/10;

}

System.out.println("Number = "+num);

System.out.println("Digit whose frequency is to be found = "+d);

System.out.println("Frequency = "+f);

}

void Number(int n1)

{

int c=n1,s=0;

while(c>0)

{

if((c%10)%2==0)

s+=c%10;

c=c/10;

}

System.out.println("Number = "+n1);

System.out.println("Sum of even digits = "+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.Scanner;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept() {

Scanner in = new Scanner(System.in);

System.out.print("Enter name: ");

name = in.nextLine();

System.out.print("Enter coach: ");

coach = in.nextLine();

System.out.print("Enter mobile no: ");

mobno = in.nextLong();

System.out.print("Enter amount: ");

amt = in.nextInt();

}

void update() {

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display() {

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main() {

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class inctax

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class number

{

Scanner sc=new Scanner(System.in);

void Number(int num,int d)

{

int c=0;

while(num>0)

{

int digit=num%10;

if(digit==d)

{

c++;

}

else

{

}

num/=10;

}

System.out.println("Frequecy of digit "+d+"="+c);

}

void Number(int n1)

{

int s=0;

while(n1>0)

{

int dig=n1%10;

if(dig%2==0)

s=s+dig;

else

n1/=10;

}

System.out.println("sum of digits= "+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.Scanner;

 class CabService
{
    String car_type;
    double km;
    double bill;

    CabService() {
        car_type = "";
        km = 0.0;
        bill = 0.0;
    }

 void accept()
 {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter car type: ");
        car_type = in.nextLine();
        System.out.print("Enter kilometer: ");
        km = in.nextDouble();
    }

     void calculate()
 {
        if (km <= 5)
{
            if (car_type.equals("AC"))
                bill = 150;
            else
                bill = 120;
        }
        else
 {
 if (car_type.equals("AC"))
   bill = 150 + 10 * (km - 5);
  else
 bill = 120 + 8 * (km - 5);
        }
    }

 void display() {
System.out.println("Car Type: " + car_type) System.out.println("Kilometer Travelled: " + km);
System.out.println("Total Bill: " + bill);
    }

    public static void main()
{
        CabService obj = new CabService();
        obj.accept();
        obj.calculate();
        obj.display();
    }
}

# data[].attributes.body
import java.util.*;

class j4

{

void joystring(String s, char ch1, char ch2)

{

String newStr = s.replace(ch1,ch2);

System.out.println(newStr);

}

void joystring(String s)

{

int f=s.indexOf(' ');

int l=s.lastIndexOf(' ');

System.out.println("First index: " + f);

System.out.println("Last index: " + l);

}

void joystring(String s1, String s2)

{

String newStr=s1.concat(" ").concat(s2);

System.out.println(newStr);

}

static void main()

{

j4 obj = new j4();

obj.joystring("TECHNALAGY", 'A', 'O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMON WEALTH", "GAMES");

}

}

# data[].attributes.body
import java.util.*;

class series

{

void series()

{

int k,sum=0;

for(k=1;k<=20;k++)

{

int term = (int)Math.pow(2,k);

if (k%2==0)

sum-= term;

else

sum+= term;

}

System.out.println("Sum=" + sum);

}

void series(int n)

{

int k,term=1;

for(k=1;k<=10;k++)

{

System.out.print(term + ", ");

term =term*10+1;

}

}

}

# data[].attributes.body
import java.util.*;

class j2

{

void Number(int num,int d)

{

int f=0;

while(num!=0)

{

int a=num%10;

if(a==d)

{

f++;

}

num=num/10;

}

System.out.println("Frequency of digit"+d+"="+f);

}

void Number(int n1)

{

int s=0;

while(n1!=0)

{

int b=n1%10;

if(b%2==0)

{

s=s+b;

}

n1=n1/10;

}

System.out.println("Sum of even numbers="+s);

}

void Number()

{

int k,p;

for(k=1;k<=5;k++)

{

for(p=1;p<=k;p++)

{

System.out.print(k);

}

System.out.println();

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

Scanner sc=new Scanner(System.in);

String name,coach;

long mobno;

int amt,totalamt=0;

void accept()

{

System.out.println("Enter your name");

name=sc.nextLine();

System.out.println("Enter coach");

coach=sc.nextLine();

System.out.println("Enter your no.");

mobno=sc.nextLong();

System.out.println("Enter your amt");

amt=sc.nextInt();

}

void calculate()

{

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt=amt+700;

if(coach.equalsIgnoreCase("Second_AC"))

totalamt=amt+500;

if(coach.equalsIgnoreCase("Third_AC"))

totalamt=amt+250;

if(coach.equalsIgnoreCase("Sleeper"))

totalamt=amt;

}

}

void display()

{

System.out.println("Name:"+name);

System.out.println("Coach:"+coach);

System.out.println("Totalamount:"+totalamt);

System.out.println("Mobile Number:"+mobno);

}

static void main()

{

RailwayTicket obj=new RailwayTicket();

obj.accept();

obj.calculate();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class j3

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

void main()

{

j3 obj = new j3();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class J7

{

double volume(double r)

{

double vol=(4/3.0)*(22/7.0)*r*r*r;

return vol;

}

double volume(double h, double r)

{

double vol=(22/7.0)*r*r*h;

return vol;

}

double volume(double l, double b, double h)

{

double vol=l*b*h;

return vol;

}

static void main()

{

J7 obj = new J7();

System.out.println("Sphere Volume = " + obj.volume(6));

System.out.println("Cylinder Volume = " + obj.volume(5, 3.5));

System.out.println("Cuboid Volume = " + obj.volume(7.5, 3.5, 2));

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name,coach;

long mobno;

int amt,totalamt=0;

void accept()

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter name");

name=sc.nextLine();

System.out.println("Enter coach");

coach=sc.nextLine();

System.out.println("Enter mobile number");

mobno=sc.nextLong();

System.out.println("Enter amount");

amt=sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt=amt+700;

if(coach.equalsIgnoreCase("Second_AC"))

totalamt=amt+500;

if(coach.equalsIgnoreCase("Third_AC"))

totalamt=amt+250;

if(coach.equalsIgnoreCase("Sleeper"))

totalamt=amt;

}

void display()

{

System.out.println("Name of the person: "+name);

System.out.println("Coach: "+coach);

System.out.println("Total amount: "+totalamt);

System.out.println("Mobile number: "+mobno);

}

void main()

{

RailwayTicket obj=new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.*;

class j4

{

void joystring(String s, char ch1, char ch2)

{

String newStr = s.replace(ch1,ch2);

System.out.println(newStr);

}

void joystring(String s)

{

int f=s.indexOf(' ');

int l=s.lastIndexOf(' ');

System.out.println("First index: " + f);

System.out.println("Last index: " + l);

}

void joystring(String s1, String s2)

{

String newStr=s1.concat(" ").concat(s2);

System.out.println(newStr);

}

void main()

{

j4 obj = new j4();

obj.joystring("TECHNALAGY", 'A', 'O');

obj.joystring("Cloud computing means Internet based computing");

obj.joystring("COMMON WEALTH", "GAMES");

}

}

# data[].attributes.body
import java.util.*;

class j5

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class RailwayTicket

{

String name;

String coach;

long mobno;

int amt;

int totalamt;

void accept()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter name: ");

name = sc.nextLine();

System.out.print("Enter coach: ");

coach = sc.nextLine();

System.out.print("Enter mobile no: ");

mobno = sc.nextLong();

System.out.print("Enter amount: ");

amt = sc.nextInt();

}

void update()

{

if(coach.equalsIgnoreCase("First_AC"))

totalamt = amt + 700;

else if(coach.equalsIgnoreCase("Second_AC"))

totalamt = amt + 500;

else if(coach.equalsIgnoreCase("Third_AC"))

totalamt = amt + 250;

else if(coach.equalsIgnoreCase("Sleeper"))

totalamt = amt;

}

void display()

{

System.out.println("Name: " + name);

System.out.println("Coach: " + coach);

System.out.println("Total Amount: " + totalamt);

System.out.println("Mobile number: " + mobno);

}

static void main()

{

RailwayTicket obj = new RailwayTicket();

obj.accept();

obj.update();

obj.display();

}

}

# data[].attributes.body
import java.util.Scanner;

class IncomeTax

{

static void main() {

Scanner in = new Scanner(System.in);

System.out.print("Enter Gender (male/female): ");

String gender= in.nextLine();

System.out.print("Enter Age: ");

int age = in.nextInt();

System.out.print("Enter taxable income: ");

double ti = in.nextDouble();

double tax = 0.0;

if (age > 65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else {

if (ti <= 160000)

tax = 0;

else if (ti <= 500000)

tax = (ti - 160000) * 10/100;

else if (ti <= 800000)

tax = 34000 + ((ti - 500000) * 20 / 100);

else

tax = 94000 + ((ti - 1000000) * 30 / 100);

}

System.out.println("Tax Payable: " + tax);

}

}

# data[].attributes.body
import java.util.*;

class j5

{

static void main()

{

Scanner sc = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class income_tax

{

static void main()

{

Scanner sc=new Scanner(System.in);

int age;

String gender;

double ti, tax=0;

System.out.println("Enter your gender");

gender=sc.nextLine();

System.out.println("Enter your age");

age=sc.nextInt();

System.out.println("Enter your taxable income");

ti=sc.nextDouble();

if(age<=65 && gender.equalsIgnoreCase("Male"))

{

if(ti<=160000)

tax=0;

else if(ti>160000 && ti<=500000)

tax=(ti-160000)*10/100;

else if(ti>500000 && ti<=800000)

tax=((ti-500000)*20/100)+34000;

else

tax=((ti-800000)*30/100)+94000;

System.out.println("Tax payable: "+tax);

}

else

{

System.out.println("Wrong Category");

}

}

}

# data[].attributes.body
import java.util.*;

class incometax

{

static void main()

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = sc.nextLine();

System.out.print("Enter Age: ");

int age = sc.nextInt();

System.out.print("Enter Taxable Income: ");

double ti=sc.nextDouble();

double tax=0.0;

if (age>65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else

{

if(ti<=160000)

tax=0;

else if(ti<=500000)

tax=(ti-160000)*10/100;

else if(ti<=800000)

tax=34000+((ti-500000)*20/100);

else

tax=94000+((ti-800000)*30/100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.Scanner;

public class KboatIncomeTax

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

System.out.print("Enter Gender(male/female): ");

String gender = in.nextLine();

System.out.print("Enter Age: ");

int age = in.nextInt();

System.out.print("Enter Taxable Income: ");

double ti = in.nextDouble();

double tax = 0.0;

if (age > 65 || gender.equalsIgnoreCase("female")) {

System.out.print("Wrong Category");

}

else {

if (ti <= 160000)

tax = 0;

else if (ti <= 500000)

tax = (ti - 160000) * 10 / 100;

else if (ti <= 800000)

tax = 34000 + ((ti - 500000) * 20 / 100);

else

tax = 94000 + ((ti - 800000) * 30 / 100);

System.out.println("Tax Payable: " + tax);

}

}

}

# data[].attributes.body
import java.util.*;

class j6

{

void series()

{

int k,sum=0;

for(k=1;k<=20;k++)

{

int term = (int)Math.pow(2,k);

if (k%2==0)

sum-= term;

else

sum+= term;

}

System.out.println("Sum=" + sum);

}

void series(int n)

{

int k,term=1;

for(k=1;k<=10;k++)

{

System.out.print(term + ", ");

term =term*10+1;

}

}

}

# data[].attributes.body
import java.util.*;

class j7

{

double volume(double r)

{

double vol=(4/3.0)*(22/7.0)*r*r*r;

return vol;

}

double volume(double h, double r)

{

double vol=(22/7.0)*r*r*h;

return vol;

}

double volume(double l, double b, double h)

{

double vol=l*b*h;

return vol;

}

static void main()

{

j7 obj = new j7();

System.out.println("Sphere Volume = " + obj.volume(6));

System.out.println("Cylinder Volume = " + obj.volume(5, 3.5));

System.out.println("Cuboid Volume = " + obj.volume(7.5, 3.5, 2));

}

}

# data[].attributes.body
import java.util.*;

class incometax

{

static void main() {

Scanner in = new Scanner(System.in);

System.out.print("Enter Gender (male/female): ");

String gender= in.nextLine();

System.out.print("Enter Age: ");

int age = in.nextInt();

System.out.print("Enter taxable income: ");

double ti = in.nextDouble();

double tax = 0.0;

if (age > 65||gender.equalsIgnoreCase("female"))

{

System.out.print("Wrong Category");

}

else {

if (ti <= 160000)

tax = 0;

else if (ti <= 500000)

tax = (ti - 160000) * 10/100;

else if (ti <= 800000)

tax = 34000 + ((ti - 500000) * 20 / 100);

else

tax = 94000 + ((ti - 1000000) * 30 / 100);

}

System.out.println("Tax Payable: " + tax);

}

}