我是初學者.....我不能似乎解決涉及多個方法這個問題....使用掃描儀的方法沒有做任何事情解決不了這個:
package bucky;
import java.util.Scanner;
public class test {
public static void main(String args[]){
input();
for(int time=1;time<values[2];++time){
double A=values[1]*Math.pow(1+values[3], time);
System.out.println("You have: "+A+ " subscribers today");
}}
public static double[] input(){
Scanner s=new Scanner(System.in);
double[] values=new double[3];
System.out.println("Enter the Principal value: ");
values[1]=s.nextDouble();
System.out.println("Enter the no. of days: ");
values[2]=s.nextInt();
System.out.println("Enter the Rate of growth : ");
values[3]=s.nextDouble();
return values;
}
}
現在,正是你想做什麼?你的問題沒有任何明確說明請檢查如何提出問題。 –
問題是? – Lucero
它不編譯。 'values []'在主要方法中不可訪問 –