SlideShare a Scribd company logo
1 of 6
Download to read offline
Please help me find my error/s. I am lost as I know what the problem is but not sure how to fix it.
Problem: Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method getNumberofdays() is undefined for the type Year
The method getNumberofdays() is undefined for the type LeapYear
at UseYear.main(UseYear.java:11)
UseYear.java
public class UseYear
{
public static void main(String args[])
{
//Initializing class
Year year = new Year();
//Calling method to display days
year.getNumberofdays();
//Initializing class
LeapYear leapyear = new LeapYear();
//Calling to display days
leapyear.getNumberofdays();
}
}
LeapYear.java
public class LeapYear extends Year
{
//Constructor for LeapYear class
public LeapYear()
{
setNumberofdays(366);
}
}
Year.java
public class Year
{
//Variable
int numberofdays;
public void getNumberofdays
{
System.out.println(numberofdays);
}
//Method to set the value
public void setNumberofdays(int numberofdays)
{
this.numberofdays = numberofdays;
}
//Constructor for Year class
public Year()
{
setNumberofdays(365);
}
}
UseYear2.java
public class UseYear2
{
public static void main(String args[])
{
int day = 2, month = 3;
//Initializing class
Year2 year = new Year2();
//Initializing class
LeapYear2 leapyear = new LeapYear2();
//Display days elapsed
System.out.println("Days elapsed in a Year: " + year.daysElapsed(day, month));
System.out.println("Days elapsed in a Leap Year: " + leapyear.daysElapsed(day, month));
}
}
LeapYear2.java
public class LeapYear extends Year
{
//Constructor for class
public LeapYear2()
{
//Setting number of days
setNumberofdays(366);
}
//Method to get end value
public int daysElapsed(int day, int month)
{
int temp = 0;
for (int i = 1; i < month;i++);
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
temp += 31;
}
else if (i == 4 || i == 6 || i == 9 || i == 11)
{
temp += 30;
}
else if (i == 2)
{
temp += 29;
}
}
temp += day;
return temp;
}
}
Year2.java
public class Year2
{
int numberofdays;
public void getNumberofdays()
{
System .out.println(numberofdays);
}
public void setNumberofdays(int numberofdays)
{
this.numberofdays = numberofdays;
}
public Year2()
{
setNumberofdays(365);
}
public int daysElapsed(int day, int month)
{
int temp = 0;
for (int i = 1; i < month;i++);
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
temp += 31;
}
else if (i == 4 || i == 6 || i == 9 || i == 11)
{
temp += 30;
}
else if (i == 2)
{
temp += 28;
}
}
temp += day;
return temp;
}
}
Solution
HI, I have fixed all error.
Please let me know in case of any issue.
######## Year.java #######
public class Year
{
//Variable
private int numberofdays;
//Constructor for Year class
public Year()
{
setNumberofdays(365);
}
public int getNumberofdays()
{
return numberofdays;
}
//Method to set the value
public void setNumberofdays(int numberofdays)
{
this.numberofdays = numberofdays;
}
}
################## LeapYear.java ############
public class LeapYear extends Year
{
//Constructor for class
public LeapYear()
{
//Setting number of days
setNumberofdays(366);
}
//Method to get end value
public int daysElapsed(int day, int month)
{
int temp = 0;
for (int i = 1; i < month;i++)
{
if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12)
{
temp += 31;
}
else if (i == 4 || i == 6 || i == 9 || i == 11)
{
temp += 30;
}
else if (i == 2)
{
temp += 29;
}
}
temp += day;
return temp;
}
}
######### UseYear.java ###############
public class UseYear
{
public static void main(String args[])
{
//Initializing class
Year year = new Year();
//Calling method to display days
System.out.println(year.getNumberofdays());
//Initializing class
LeapYear leapyear = new LeapYear();
//Calling to display days
System.out.println(leapyear.getNumberofdays());
}
}

More Related Content

Similar to Please help me find my errors. I am lost as I know what the problem.pdf

WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...MaruMengesha
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testingEric (Trung Dung) Nguyen
 
Presentacion clean code
Presentacion clean codePresentacion clean code
Presentacion clean codeIBM
 
Jeremiah Caballero - Introduction of Clean Code
Jeremiah Caballero - Introduction of Clean CodeJeremiah Caballero - Introduction of Clean Code
Jeremiah Caballero - Introduction of Clean CodeAwesome Ars Academia
 
Structure and Interpretation of Test Cases
Structure and Interpretation of Test CasesStructure and Interpretation of Test Cases
Structure and Interpretation of Test CasesKevlin Henney
 
Java22_1670144363.pptx
Java22_1670144363.pptxJava22_1670144363.pptx
Java22_1670144363.pptxDilanAlmsa
 
Software design principles SOLID
Software design principles SOLIDSoftware design principles SOLID
Software design principles SOLIDFoyzul Karim
 
Java™ (OOP) - Chapter 10: "Thinking in Objects"
Java™ (OOP) - Chapter 10: "Thinking in Objects"Java™ (OOP) - Chapter 10: "Thinking in Objects"
Java™ (OOP) - Chapter 10: "Thinking in Objects"Gouda Mando
 
05. Java Loops Methods and Classes
05. Java Loops Methods and Classes05. Java Loops Methods and Classes
05. Java Loops Methods and ClassesIntro C# Book
 
enum_comp_exercicio01.docx
enum_comp_exercicio01.docxenum_comp_exercicio01.docx
enum_comp_exercicio01.docxMichel Valentim
 
Basic Java Application Developer Sesi 2
Basic Java Application Developer Sesi 2Basic Java Application Developer Sesi 2
Basic Java Application Developer Sesi 2Rudi Hartono
 
Java Programs
Java ProgramsJava Programs
Java Programsvvpadhu
 

Similar to Please help me find my errors. I am lost as I know what the problem.pdf (20)

Functional C++
Functional C++Functional C++
Functional C++
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Java Lab Manual
Java Lab ManualJava Lab Manual
Java Lab Manual
 
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...
WINSEM2020-21_STS3105_SS_VL2020210500169_Reference_Material_I_10-Feb-2021_L4_...
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testing
 
JavaProgrammingManual
JavaProgrammingManualJavaProgrammingManual
JavaProgrammingManual
 
Presentacion clean code
Presentacion clean codePresentacion clean code
Presentacion clean code
 
Jeremiah Caballero - Introduction of Clean Code
Jeremiah Caballero - Introduction of Clean CodeJeremiah Caballero - Introduction of Clean Code
Jeremiah Caballero - Introduction of Clean Code
 
Structure and Interpretation of Test Cases
Structure and Interpretation of Test CasesStructure and Interpretation of Test Cases
Structure and Interpretation of Test Cases
 
Java22_1670144363.pptx
Java22_1670144363.pptxJava22_1670144363.pptx
Java22_1670144363.pptx
 
Software design principles SOLID
Software design principles SOLIDSoftware design principles SOLID
Software design principles SOLID
 
Java™ (OOP) - Chapter 10: "Thinking in Objects"
Java™ (OOP) - Chapter 10: "Thinking in Objects"Java™ (OOP) - Chapter 10: "Thinking in Objects"
Java™ (OOP) - Chapter 10: "Thinking in Objects"
 
Test Time Bombs
Test Time BombsTest Time Bombs
Test Time Bombs
 
05. Java Loops Methods and Classes
05. Java Loops Methods and Classes05. Java Loops Methods and Classes
05. Java Loops Methods and Classes
 
enum_comp_exercicio01.docx
enum_comp_exercicio01.docxenum_comp_exercicio01.docx
enum_comp_exercicio01.docx
 
Initial Java Core Concept
Initial Java Core ConceptInitial Java Core Concept
Initial Java Core Concept
 
ES2015 workflows
ES2015 workflowsES2015 workflows
ES2015 workflows
 
15. DateTime API.ppt
15. DateTime API.ppt15. DateTime API.ppt
15. DateTime API.ppt
 
Basic Java Application Developer Sesi 2
Basic Java Application Developer Sesi 2Basic Java Application Developer Sesi 2
Basic Java Application Developer Sesi 2
 
Java Programs
Java ProgramsJava Programs
Java Programs
 

More from fathimahardwareelect

Which one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdfWhich one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdffathimahardwareelect
 
Which of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdfWhich of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdffathimahardwareelect
 
What is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdfWhat is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdffathimahardwareelect
 
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdfWhat mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdffathimahardwareelect
 
using the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdfusing the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdffathimahardwareelect
 
True or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdfTrue or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdffathimahardwareelect
 
True or False. If H is a subgroup of the group G then H is one of it.pdf
True or False.  If H is a subgroup of the group G then H is one of it.pdfTrue or False.  If H is a subgroup of the group G then H is one of it.pdf
True or False. If H is a subgroup of the group G then H is one of it.pdffathimahardwareelect
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdffathimahardwareelect
 
Immunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdfImmunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdffathimahardwareelect
 
Question 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdfQuestion 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdffathimahardwareelect
 
Question 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdfQuestion 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdffathimahardwareelect
 
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdfQuestion 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdffathimahardwareelect
 
List and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdfList and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdffathimahardwareelect
 
Please write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdfPlease write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdffathimahardwareelect
 
Negligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdfNegligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdffathimahardwareelect
 
Incuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdfIncuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdffathimahardwareelect
 
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdfIdentify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdffathimahardwareelect
 
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdfHow many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdffathimahardwareelect
 
How does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdfHow does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdffathimahardwareelect
 
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdfHow do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdffathimahardwareelect
 

More from fathimahardwareelect (20)

Which one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdfWhich one of the following is NOT a social trend that is currently af.pdf
Which one of the following is NOT a social trend that is currently af.pdf
 
Which of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdfWhich of the following is normally a major activity of materials man.pdf
Which of the following is normally a major activity of materials man.pdf
 
What is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdfWhat is the role of civil society in promoting democracySolutio.pdf
What is the role of civil society in promoting democracySolutio.pdf
 
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdfWhat mechanism causes plant ion-uptake to acidify soilSolution.pdf
What mechanism causes plant ion-uptake to acidify soilSolution.pdf
 
using the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdfusing the knowledge about experiments that are related to plant g.pdf
using the knowledge about experiments that are related to plant g.pdf
 
True or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdfTrue or False Justify your answer.The concept of flooding is alwa.pdf
True or False Justify your answer.The concept of flooding is alwa.pdf
 
True or False. If H is a subgroup of the group G then H is one of it.pdf
True or False.  If H is a subgroup of the group G then H is one of it.pdfTrue or False.  If H is a subgroup of the group G then H is one of it.pdf
True or False. If H is a subgroup of the group G then H is one of it.pdf
 
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdfTHE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
THE CODE HAS A SEGMENTATION FAULT BUT I CANNOT FIND OUT WHERE. NEED .pdf
 
Immunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdfImmunizations that the elderly need to receive on a yearly basis inc.pdf
Immunizations that the elderly need to receive on a yearly basis inc.pdf
 
Question 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdfQuestion 11 Scarcity means O people need to use marginal analysis to .pdf
Question 11 Scarcity means O people need to use marginal analysis to .pdf
 
Question 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdfQuestion 2 Sba Do you know something about the Statement Of Financ.pdf
Question 2 Sba Do you know something about the Statement Of Financ.pdf
 
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdfQuestion 1. give the CC++ code that defines an empty 5 element arra.pdf
Question 1. give the CC++ code that defines an empty 5 element arra.pdf
 
List and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdfList and explain all the components of company culture.Jackson, S..pdf
List and explain all the components of company culture.Jackson, S..pdf
 
Please write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdfPlease write 5-6 setences about each emotional intelligence capabili.pdf
Please write 5-6 setences about each emotional intelligence capabili.pdf
 
Negligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdfNegligence and intentional torts are subject to civil litigation as .pdf
Negligence and intentional torts are subject to civil litigation as .pdf
 
Incuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdfIncuded within the major CPI basket groups are various government-cha.pdf
Incuded within the major CPI basket groups are various government-cha.pdf
 
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdfIdentify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
Identify major groupings within the Lophotrochozoa and Ecdy gg g soz.pdf
 
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdfHow many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
How many grams of solid NaCN have to be added to 1.4 L of water to d.pdf
 
How does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdfHow does Warhol add to the semiotic statement of the readymadeS.pdf
How does Warhol add to the semiotic statement of the readymadeS.pdf
 
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdfHow do I add a ComboBox to this, underneath Enter Student ID tha.pdf
How do I add a ComboBox to this, underneath Enter Student ID tha.pdf
 

Recently uploaded

How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfstareducators107
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 

Recently uploaded (20)

How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Simple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdfSimple, Complex, and Compound Sentences Exercises.pdf
Simple, Complex, and Compound Sentences Exercises.pdf
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

Please help me find my errors. I am lost as I know what the problem.pdf

  • 1. Please help me find my error/s. I am lost as I know what the problem is but not sure how to fix it. Problem: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method getNumberofdays() is undefined for the type Year The method getNumberofdays() is undefined for the type LeapYear at UseYear.main(UseYear.java:11) UseYear.java public class UseYear { public static void main(String args[]) { //Initializing class Year year = new Year(); //Calling method to display days year.getNumberofdays(); //Initializing class LeapYear leapyear = new LeapYear(); //Calling to display days leapyear.getNumberofdays(); } } LeapYear.java public class LeapYear extends Year { //Constructor for LeapYear class public LeapYear() { setNumberofdays(366); } } Year.java public class Year { //Variable int numberofdays;
  • 2. public void getNumberofdays { System.out.println(numberofdays); } //Method to set the value public void setNumberofdays(int numberofdays) { this.numberofdays = numberofdays; } //Constructor for Year class public Year() { setNumberofdays(365); } } UseYear2.java public class UseYear2 { public static void main(String args[]) { int day = 2, month = 3; //Initializing class Year2 year = new Year2(); //Initializing class LeapYear2 leapyear = new LeapYear2(); //Display days elapsed System.out.println("Days elapsed in a Year: " + year.daysElapsed(day, month)); System.out.println("Days elapsed in a Leap Year: " + leapyear.daysElapsed(day, month)); } } LeapYear2.java public class LeapYear extends Year { //Constructor for class public LeapYear2() {
  • 3. //Setting number of days setNumberofdays(366); } //Method to get end value public int daysElapsed(int day, int month) { int temp = 0; for (int i = 1; i < month;i++); { if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) { temp += 31; } else if (i == 4 || i == 6 || i == 9 || i == 11) { temp += 30; } else if (i == 2) { temp += 29; } } temp += day; return temp; } } Year2.java public class Year2 { int numberofdays; public void getNumberofdays() { System .out.println(numberofdays); } public void setNumberofdays(int numberofdays)
  • 4. { this.numberofdays = numberofdays; } public Year2() { setNumberofdays(365); } public int daysElapsed(int day, int month) { int temp = 0; for (int i = 1; i < month;i++); { if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) { temp += 31; } else if (i == 4 || i == 6 || i == 9 || i == 11) { temp += 30; } else if (i == 2) { temp += 28; } } temp += day; return temp; } } Solution HI, I have fixed all error. Please let me know in case of any issue. ######## Year.java #######
  • 5. public class Year { //Variable private int numberofdays; //Constructor for Year class public Year() { setNumberofdays(365); } public int getNumberofdays() { return numberofdays; } //Method to set the value public void setNumberofdays(int numberofdays) { this.numberofdays = numberofdays; } } ################## LeapYear.java ############ public class LeapYear extends Year { //Constructor for class public LeapYear() { //Setting number of days setNumberofdays(366); } //Method to get end value public int daysElapsed(int day, int month) { int temp = 0; for (int i = 1; i < month;i++) { if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) {
  • 6. temp += 31; } else if (i == 4 || i == 6 || i == 9 || i == 11) { temp += 30; } else if (i == 2) { temp += 29; } } temp += day; return temp; } } ######### UseYear.java ############### public class UseYear { public static void main(String args[]) { //Initializing class Year year = new Year(); //Calling method to display days System.out.println(year.getNumberofdays()); //Initializing class LeapYear leapyear = new LeapYear(); //Calling to display days System.out.println(leapyear.getNumberofdays()); } }