Question: Why isnt this compiling, even when I put the public static void main(String[] arg) it wont compile? full code: public class CollegeInfo { String college_name;

Why isnt this compiling, even when I put the public static void main(String[] arg) it wont compile?

Why isnt this compiling, even when I put the public static void

full code:

public class CollegeInfo {

String college_name;

int sticker_price;

int net_price;

int discount;

//getter and setters of variables of class

public String getCollege_name() {

return college_name;

}

public void setCollege_name(String college_name) {

this.college_name = college_name;

}

public int getSticker_price() {

return sticker_price;

}

public void setSticker_price(int sticker_price) {

this.sticker_price = sticker_price;

}

public int getNet_price() {

return net_price;

}

public void setNet_price(int net_price) {

this.net_price = net_price;

}

//calculating discount provided by college

public void discount(){

discount=(int)((sticker_price-net_price)/sticker_price*100);

}

//returning the discount

public int getDiscount() {

return discount;

}

}

import java.util.Scanner;

public class MainClass {

//static members created to hold values which should not change with new object creation

static int avg_stick_price;//to hold average sticker price

static int avg_net_price;//to hold average net price

static int avg_discount;//to hold the discount

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

System.out.println("Enter Number of colleges to be entered: ");

int n=sc.nextInt();//asking user to provide length of array

CollegeInfo[] college_array=new CollegeInfo[n];//creating college array

for(int i=0;i

{

college_array[i]=new CollegeInfo();//assigning array term class

System.out.println("Enter Name of College: ");

college_array[i].setCollege_name(sc.next());//using setters to enter values

System.out.println("Enter Sticker Price: ");

college_array[i].setSticker_price(sc.nextInt());

avg_stick_price=avg_stick_price+college_array[i].getSticker_price();//using getters to calculate total for calculating average

System.out.println("Enter Net Price: ");

college_array[i].setNet_price(sc.nextInt());

avg_net_price=avg_net_price+college_array[i].getNet_price();

college_array[i].discount();

avg_discount=avg_discount+college_array[i].getDiscount();

}

System.out.format("%50s %16s %16s %16s ","College","Sticker Price","Net Price","% Discount Rate");

avg_stick_price=avg_stick_price;

avg_net_price=avg_net_price;

avg_discount=avg_discount;

//printing the result

for(int j=0;j

{

if(college_array[j].getDiscount()>=60)

{

//using string formatting

System.out.format("%50s %16s %16s %16s ",college_array[j].getCollege_name()+"**","$"+college_array[j].getSticker_price(),"$"+college_array[j].getNet_price(),college_array[j].getDiscount());

}else if(college_array[j].getDiscount()>=50)

{

System.out.format("%50s %16s %16s %16s ",college_array[j].getCollege_name()+"*","$"+college_array[j].getSticker_price(),"$"+college_array[j].getNet_price(),college_array[j].getDiscount());

}else

{

System.out.format("%50s %16s %16s %16s ",college_array[j].getCollege_name(),"$"+college_array[j].getSticker_price(),"$"+college_array[j].getNet_price(),college_array[j].getDiscount());

}

}

System.out.format("%50s %16s %16s %16s","Average","$"+avg_stick_price,"$"+avg_net_price,avg_discount);

}

}

2 3 import java.util.Scanner 5 public class CollegeInfo 6 String college name; int sticker price; int net price; int discount; 9 10 12 13 14 156 16 17 18 19 20 21 226 23 24 25 26 27 28 29- 30 //getter and setters of variables of class public String getCollege name() return college.name; public void setcollege_name (String college_name) this.college name college name public int getsticker_price() Problems e Javadoc Declaration Console 3 Tasks terminated> Collegeinfo Java Application] C:lProgram FilesJavaljre1,8.0.144 bin javaw.exe (Oun 24 2018, 716:10 PM) Error: Main method not found in class CollegeInfo, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!