我是初学者.....我不能似乎解决涉及多个方法这个问题....使用扫描仪的方法没有做任何事情解决不了这个:
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 []'在主要方法中不可访问 –