My problem is: how to convert integer into double in an arguments or in a method? is that possible?.
here is my code :
public class MultimediaComputer extends Computer{
protected int cdrom;
protected double no;
public MultimediaComputer(int pm,int cd,int cm) {
super(cd,pm);
cdrom = cm;
Cdromspeed(cm);
}
public int Cdromspeed(int cm){
return cm;
}
public void display(){
System.out.println("Multimedia Computer");
System.out.println("Processor mode:" + processormode);
System.out.println("Clock Speed:" + clockspeed);
System.out.println("CD-ROM speed:" + cdrom);
}
}
then the main:
public class Main{
public static void main (String []args){
Computer e = new Computer(486,166);
// here is my problem the argument accept an integer but not double
//then i want to put if-else that if the value is >1000 it becomes double or else an integer
MultimediaComputer o = new MultimediaComputer(1.2,800,48);
e.display();
o.display();
}
}
is that possible or i need to create a new method for conversion?


Sign In
Create Account


Back to top









