Computer Science, asked by bandhan123, 1 year ago

In Bluej, I wrote a program and when I executed it, I saw that "void main(String[] args" option was not coming. Can anyone please resolve this issue? The program is-

import java.util.*;

class Atransport

{

String name;

int w;

int charge = 0;

void accept(String a, int b)

{

name = a;

w = b;

}

void calculate()

{

if (w <= 10)

charge = 25 * w;

if (w > 10 && w <= 30)

charge = (25 * 10) + (20 * (w - 10));

if (w > 30)

charge = (25 * 10) + (20 * 10) + (10 * (w - 30));

}



void print()

{

System.out.println("Name\t\t\tWeight\t\t\tBill amount");

System.out.println(name + "\t\t\t" + w + "\t\t\t" + charge);

}

}

class Pro_Atransport

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

int m;

String n;

System.out.println("Enter the name of the customer");

n = in.nextLine();

System.out.println("Enter the weight of the parcel");

m = in.nextInt();

Atransport obj = new Atransport();

obj.accept(n,m);

obj.calculate();

obj.print();

}

}



Answers

Answered by nishthav
0

hi there instead of void accept u cud try typing public static void main

hope it helps

Answered by rongalasriharsha9
0
What the fish and chicken
Similar questions