I have this variable of type PreciseTime that I need to instantiate to get it into a class called PhoneCall. here's the PhoneCall object signature [PhoneCall(PreciseTime, Precise Time).
With that said I need to create a precise time object first before instantiating my PhoneCall.
My user input variable is startIn. I have a method in PreciseTime called PreciseTime fromString(String).
What am I missing to create my PreciseTime object
PreciseTime callStart = new PreciseTime(startIn.fromString());
Here is the compile error I get.
CallCost.java:48: cannot find symbol
symbol : method fromString()
location: class java.lang.String
PreciseTime callStart = new PreciseTime(startIn.fromString());
^
CallCost.java:48: internal error; cannot instantiate PreciseTime.<init> at PreciseTime to ()
PreciseTime callStart = new PreciseTime(startIn.fromString());
Question 2:
I need to write my PhoneCall object called phoneCall to a custom made string method. The call to the string is inside class PhoneCall. The toString() should call another toString() method inside another class. I want to make the one call and have it cascade to the other classes.
main -- printOut.write(phoneCall.toString());
PhoneCall class -- String startTimeOutput = startTime.toString(); startTime is a PreciseTime object and an instance variable in this class
PreciseTime class -- return twentyFourHrTime; String toString(PreciseTime o) is the method and as you can see, accepts a PreciseTime object.
What is wrong with the call from main? Below are the error messages.
CallCost.java:65: write(java.lang.String) has private access in java.io.PrintStream
printOut.write(phoneCall.toString());
THANK YOU!