I have that code I work on it and every think is fine until I wrote a
String c = s.nextLine();
and it's not work he is sikp the enter from the user and go to next one and I don't know where is the problem maybe logic error or some think like this but until I delete a Line it's became next(); and it's work but if i want to be nextLine() what can i do ?and I would like to know why isn't work with me and work with me with another code?
so hear is the class redio
package radiotester;
public class Radio {
private double frequency;
private String channel;
private int followers;
public Radio() {
frequency=0.0;
channel="";
followers=0;
}
public Radio(double frequency, String channel, int followers) {
this.frequency = frequency;
this.channel = channel;
this.followers = followers;
}
public void printAll (){
System.out.println("the frequency ="+frequency);
System.out.println("the channel = "+channel);
System.out.println("the followers = "+followers);
}
public void setFrequency(double f) {
f = frequency;
}
public double getFrequency() {
return frequency;
}
}
and here is the test of class raido here is the problem
package radiotester;
import java.util.Scanner;
public class RadioTester {
public static void main(String[] args) {
Scanner s = new Scanner (System.in);
Radio Radio1 = new Radio ();
Radio1.printAll();
System.out.println("plase give the raido requency");
double r = s.nextDouble();
System.out.println("plase give the raido channle");
String c = s.next();
System.out.println("plase give the raido follwers");
int f = s.nextInt();
Radio Radio2 = new Radio (r,c,f);
System.out.println("old character of raido2");
Radio2.printAll();
Radio2.setFrequency(100.5);
System.out.println("new character of raido2");
Radio2.printAll();
}}