Hello i am new to programming. I have a basic doubt, hope it's not silly. I have 2 classes, my first class named dialytravel
calculates money spend in travel on one day. In my second class names weaklytravel
I want to use the sum(from the dailytravel
class) to calculate the weakly cost for traveling. my code is bellow
Public class dailytravel {
private int morning = 3;
private int evening = 3;
private int sum;
sum = morning+evening;
System.out.println("The money sent for travel in one day" +sum);
}
Below is my second class named weaklytravel. How can I use sum in this class.
Public class weaklytravel {
private int noofday = 5;
private int weakly ;
weakly = sum * noofdays;
System.out.println("The money sent for travel in one weak" +weakly);
}