Can you see whats wrong with the program : Test.java:7: error: cannot find symbol Course CourseOne = new Course(); ^ symbol: class Course location: class Test Test.java:7: error: cannot find symbol Course CourseOne = new Course(); ^ symbol: class Course location: class Test 2 errors error: compilation failed The program is : import java.io.*; import javax.swing.*; public class Test { public static void main (String args[]){ Course CourseOne = new Course(); JTextField CourseIDField = new JTextField(5); JTextField CourseNameField = new JTextField(5); JTextField CourseCreditField = new JTextField(5); JTextField CourseDescField = new JTextField(5); String val; String Val2; String Val3; String Val4; CourseOne.SetCourseDetails("1000", "Java I","10", "This is good course"); CourseOne.printDetail(); Object[] message = { "Course ID", CourseIDField , "Course Name", CourseNameField , "Course Credit ", CourseCreditField, "Course Description", CourseDescField}; int option = JOptionPane.showConfirmDialog(null, message,"Course Details", JOptionPane.OK_CANCEL_OPTION); if (option == JOptionPane.OK_OPTION){ val = CourseIDField.getText(); Val2 = CourseNameField.getText(); Val3 = CourseCreditField.getText(); Val4 = CourseDescField.getText(); CourseOne.SetCourseDetails(val, Val2, Val3, Val4); CourseOne.printDetail(); } } } And the second one : public class Course{ private String Code; private String Name; private String Credit; private String Description; public void SetCourseDetails(String CourseCode, String CourseName, String CourseCredit, String CourseDesc){ Code = CourseCode; Name = CourseName; Credit = CourseCredit; Description = CourseDesc; } public void printDetail(){ System.out.println("Course Code :" + Code); System.out.println("Course Name :" + Name); System.out.println("Credit Score :" + Credit); System.out.println("Description Score :" + Description); } }
Can you see whats wrong with the program : Test.java:7: error: cannot find symbol
Course CourseOne = new Course();
^
symbol: class Course
location: class Test
Test.java:7: error: cannot find symbol
Course CourseOne = new Course();
^
symbol: class Course
location: class Test
2 errors
error: compilation failed
The program is :
import java.io.*;
import javax.swing.*;
public class Test {
public static void main (String args[]){
Course CourseOne = new Course();
JTextField CourseIDField = new JTextField(5);
JTextField CourseNameField = new JTextField(5);
JTextField CourseCreditField = new JTextField(5);
JTextField CourseDescField = new JTextField(5);
String val;
String Val2;
String Val3;
String Val4;
CourseOne.SetCourseDetails("1000", "Java I","10", "This is good course");
CourseOne.printDetail();
Object[] message = { "Course ID", CourseIDField , "Course Name", CourseNameField , "Course Credit ", CourseCreditField, "Course Description", CourseDescField};
int option = JOptionPane.showConfirmDialog(null, message,"Course Details", JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION){
val = CourseIDField.getText();
Val2 = CourseNameField.getText();
Val3 = CourseCreditField.getText();
Val4 = CourseDescField.getText();
CourseOne.SetCourseDetails(val, Val2, Val3, Val4);
CourseOne.printDetail();
}
}
}
And the second one :
public class Course{
private String Code;
private String Name;
private String Credit;
private String Description;
public void SetCourseDetails(String CourseCode, String CourseName, String CourseCredit, String CourseDesc){
Code = CourseCode;
Name = CourseName;
Credit = CourseCredit;
Description = CourseDesc;
}
public void printDetail(){
System.out.println("Course Code :" + Code);
System.out.println("Course Name :" + Name);
System.out.println("Credit Score :" + Credit);
System.out.println("Description Score :" + Description);
}
}
Step by step
Solved in 4 steps with 2 images