Java 如何使用数组进行减法/除法 //声明并初始化变量-程序员提供初始值 扫描仪输入=新扫描仪(系统输入); String city=“代托纳海滩”; 字符串state=“佛罗里达”; 双a=0; 字符串月[]={“一月”、“二月”、“三月”、“四月”、“五月”、“六月”、“七月”、“八月”、“九月”、“十月”、“十一月”、“十二月”}; 双温[]={58.4,60.0,64.7,68.9,74.8,79.7,81.7,81.5,79.9,74.0,67.0,60.8}; 双重降水[]={3.1,2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7}; 字符串tempLabel=“F”//初始化为F 字符串precipLabel=“英寸”//初始化为英寸 双c[]={32.0}; 双q[]={0.5555}; //输入-要求用户选择温度和沉淀刻度 System.out.print(“选择温度刻度(F=华氏度,C=摄氏度):”; 字符串tempChoice=in.next(); System.out.print(“选择降水量刻度(i=英寸,c=厘米):”; 字符串precipChoice=in.next(); //处理-根据用户的选择从F转换为C,从in转换为cm //记住5/9=0,5.0/9=0.5555 if(tempChoice.equalsIgnoreCase(“C”)) { tempLabel=“(C)”; 对于(int index=0;index

Java 如何使用数组进行减法/除法 //声明并初始化变量-程序员提供初始值 扫描仪输入=新扫描仪(系统输入); String city=“代托纳海滩”; 字符串state=“佛罗里达”; 双a=0; 字符串月[]={“一月”、“二月”、“三月”、“四月”、“五月”、“六月”、“七月”、“八月”、“九月”、“十月”、“十一月”、“十二月”}; 双温[]={58.4,60.0,64.7,68.9,74.8,79.7,81.7,81.5,79.9,74.0,67.0,60.8}; 双重降水[]={3.1,2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7}; 字符串tempLabel=“F”//初始化为F 字符串precipLabel=“英寸”//初始化为英寸 双c[]={32.0}; 双q[]={0.5555}; //输入-要求用户选择温度和沉淀刻度 System.out.print(“选择温度刻度(F=华氏度,C=摄氏度):”; 字符串tempChoice=in.next(); System.out.print(“选择降水量刻度(i=英寸,c=厘米):”; 字符串precipChoice=in.next(); //处理-根据用户的选择从F转换为C,从in转换为cm //记住5/9=0,5.0/9=0.5555 if(tempChoice.equalsIgnoreCase(“C”)) { tempLabel=“(C)”; 对于(int index=0;index,java,Java,不要担心降水量的换算。如何转换多个数组值(以华氏度为单位)?我试着做(例如):a[I]=b[I]-c[I],但总是得到关闭温度阵列的错误。错误应为“']” **我还收到编译器警告“上一次编译的警告: 非varargs调用最后一个参数类型不精确的varargs 周长 为varargs调用强制转换为java.lang.Object 对于非varargs调用,强制转换为java.lang.Object[],并抑制 警告 如果您在示例中引用的a是您声明的double a,那么这是因为a不是数组 此外,

不要担心降水量的换算。如何转换多个数组值(以华氏度为单位)?我试着做(例如):a[I]=b[I]-c[I],但总是得到关闭温度阵列的错误。错误应为“']”

**我还收到编译器警告“上一次编译的警告:

  • 非varargs调用最后一个参数类型不精确的varargs 周长

  • 为varargs调用强制转换为java.lang.Object

  • 对于非varargs调用,强制转换为java.lang.Object[],并抑制 警告


如果您在示例中引用的
a
是您声明的
double a
,那么这是因为
a
不是数组


此外,c和q很可能是普通的
double
s而不是数组如果您在示例中引用的
a
是您声明的
double a
,那么这是因为
a
不是数组


此外,c和q很可能是普通的
double
s而不是数组如果您在示例中引用的
a
是您声明的
double a
,那么这是因为
a
不是数组


此外,c和q很可能是普通的
double
s而不是数组如果您在示例中引用的
a
是您声明的
double a
,那么这是因为
a
不是数组


另外,c和q很可能是普通的
double
s,而不是数组

我会尽可能简单

//Declare and intialize variables - programmer to provide initial values
    Scanner in = new Scanner(System.in);
    String city = "Daytona Beach";
    String state = "Florida";
    double a =0;

    String month [] ={"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
    double temperature [] = {58.4, 60.0, 64.7, 68.9,74.8, 79.7, 81.7, 81.5,79.9,74.0,67.0,60.8};        
    double precipitation [] ={3.1, 2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7};    
    String tempLabel = "F";   //initialize to F
    String precipLabel = "inch"; //initialize to inch

    double c [] = {32.0};
    double q [] = {0.5555};

    //INPUT - ask user for temp and preciptation scale choice
    System.out.print("Choose the temperature scale (F = Fahrenheit, C = Celsius): ");
    String tempChoice = in.next();
    System.out.print("Choose the precipitation scale (i = inches, c = centimeteres): ");
    String precipChoice = in.next();


    //PROCESSING - convert from F to C and in to cm based on user's choices

    // remember 5/9 = 0, 5.0/9 = .5555

    if(tempChoice.equalsIgnoreCase("C"))
    {
        tempLabel="(C)";


        for( int index = 0; index < temperature.length; index++)
        {

        }

    }

    //Convert in values to cm; replace the current values in precipitation
    if(precipChoice.equalsIgnoreCase("c"))
    {
        precipLabel="(cm)";


    }

    //OUTPUT - print table using printf to format and align data

    System.out.println();
    System.out.println("Climate Data");
    System.out.println("Location: " + city +", " + state);
    System.out.printf("%5s %18s %s %18s %s","Month","Temperature",tempLabel,"Precipitation",precipLabel);
    System.out.printf("***************************************************");
    System.out.printf("%s\n",month);
    System.out.println();
    System.out.printf("***************************************************");
    System.out.println();
for(int index=0;index
我会让它尽可能简单

//Declare and intialize variables - programmer to provide initial values
    Scanner in = new Scanner(System.in);
    String city = "Daytona Beach";
    String state = "Florida";
    double a =0;

    String month [] ={"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
    double temperature [] = {58.4, 60.0, 64.7, 68.9,74.8, 79.7, 81.7, 81.5,79.9,74.0,67.0,60.8};        
    double precipitation [] ={3.1, 2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7};    
    String tempLabel = "F";   //initialize to F
    String precipLabel = "inch"; //initialize to inch

    double c [] = {32.0};
    double q [] = {0.5555};

    //INPUT - ask user for temp and preciptation scale choice
    System.out.print("Choose the temperature scale (F = Fahrenheit, C = Celsius): ");
    String tempChoice = in.next();
    System.out.print("Choose the precipitation scale (i = inches, c = centimeteres): ");
    String precipChoice = in.next();


    //PROCESSING - convert from F to C and in to cm based on user's choices

    // remember 5/9 = 0, 5.0/9 = .5555

    if(tempChoice.equalsIgnoreCase("C"))
    {
        tempLabel="(C)";


        for( int index = 0; index < temperature.length; index++)
        {

        }

    }

    //Convert in values to cm; replace the current values in precipitation
    if(precipChoice.equalsIgnoreCase("c"))
    {
        precipLabel="(cm)";


    }

    //OUTPUT - print table using printf to format and align data

    System.out.println();
    System.out.println("Climate Data");
    System.out.println("Location: " + city +", " + state);
    System.out.printf("%5s %18s %s %18s %s","Month","Temperature",tempLabel,"Precipitation",precipLabel);
    System.out.printf("***************************************************");
    System.out.printf("%s\n",month);
    System.out.println();
    System.out.printf("***************************************************");
    System.out.println();
for(int index=0;index
我会让它尽可能简单

//Declare and intialize variables - programmer to provide initial values
    Scanner in = new Scanner(System.in);
    String city = "Daytona Beach";
    String state = "Florida";
    double a =0;

    String month [] ={"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
    double temperature [] = {58.4, 60.0, 64.7, 68.9,74.8, 79.7, 81.7, 81.5,79.9,74.0,67.0,60.8};        
    double precipitation [] ={3.1, 2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7};    
    String tempLabel = "F";   //initialize to F
    String precipLabel = "inch"; //initialize to inch

    double c [] = {32.0};
    double q [] = {0.5555};

    //INPUT - ask user for temp and preciptation scale choice
    System.out.print("Choose the temperature scale (F = Fahrenheit, C = Celsius): ");
    String tempChoice = in.next();
    System.out.print("Choose the precipitation scale (i = inches, c = centimeteres): ");
    String precipChoice = in.next();


    //PROCESSING - convert from F to C and in to cm based on user's choices

    // remember 5/9 = 0, 5.0/9 = .5555

    if(tempChoice.equalsIgnoreCase("C"))
    {
        tempLabel="(C)";


        for( int index = 0; index < temperature.length; index++)
        {

        }

    }

    //Convert in values to cm; replace the current values in precipitation
    if(precipChoice.equalsIgnoreCase("c"))
    {
        precipLabel="(cm)";


    }

    //OUTPUT - print table using printf to format and align data

    System.out.println();
    System.out.println("Climate Data");
    System.out.println("Location: " + city +", " + state);
    System.out.printf("%5s %18s %s %18s %s","Month","Temperature",tempLabel,"Precipitation",precipLabel);
    System.out.printf("***************************************************");
    System.out.printf("%s\n",month);
    System.out.println();
    System.out.printf("***************************************************");
    System.out.println();
for(int index=0;index
我会让它尽可能简单

//Declare and intialize variables - programmer to provide initial values
    Scanner in = new Scanner(System.in);
    String city = "Daytona Beach";
    String state = "Florida";
    double a =0;

    String month [] ={"Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
    double temperature [] = {58.4, 60.0, 64.7, 68.9,74.8, 79.7, 81.7, 81.5,79.9,74.0,67.0,60.8};        
    double precipitation [] ={3.1, 2.7,3.8,2.5,3.3,5.7,5.2,6.1,6.6,4.5,3.0,2.7};    
    String tempLabel = "F";   //initialize to F
    String precipLabel = "inch"; //initialize to inch

    double c [] = {32.0};
    double q [] = {0.5555};

    //INPUT - ask user for temp and preciptation scale choice
    System.out.print("Choose the temperature scale (F = Fahrenheit, C = Celsius): ");
    String tempChoice = in.next();
    System.out.print("Choose the precipitation scale (i = inches, c = centimeteres): ");
    String precipChoice = in.next();


    //PROCESSING - convert from F to C and in to cm based on user's choices

    // remember 5/9 = 0, 5.0/9 = .5555

    if(tempChoice.equalsIgnoreCase("C"))
    {
        tempLabel="(C)";


        for( int index = 0; index < temperature.length; index++)
        {

        }

    }

    //Convert in values to cm; replace the current values in precipitation
    if(precipChoice.equalsIgnoreCase("c"))
    {
        precipLabel="(cm)";


    }

    //OUTPUT - print table using printf to format and align data

    System.out.println();
    System.out.println("Climate Data");
    System.out.println("Location: " + city +", " + state);
    System.out.printf("%5s %18s %s %18s %s","Month","Temperature",tempLabel,"Precipitation",precipLabel);
    System.out.printf("***************************************************");
    System.out.printf("%s\n",month);
    System.out.println();
    System.out.printf("***************************************************");
    System.out.println();
for(int index=0;index
试试这个:

for( int index = 0; index < temperature.length; index++) {
    double celsius = (temperature[i] - 32)*5/9;
if(tempChoice.equalsIgnoreCase(“C”))
{
tempLabel=“(C)”;
对于(int index=0;index
试试这个:

for( int index = 0; index < temperature.length; index++) {
    double celsius = (temperature[i] - 32)*5/9;
if(tempChoice.equalsIgnoreCase(“C”))
{
tempLabel=“(C)”;
对于(int index=0;index
试试这个:

for( int index = 0; index < temperature.length; index++) {
    double celsius = (temperature[i] - 32)*5/9;
if(tempChoice.equalsIgnoreCase(“C”))
{
tempLabel=“(C)”;
对于(int index=0;index
试试这个:

for( int index = 0; index < temperature.length; index++) {
    double celsius = (temperature[i] - 32)*5/9;
if(tempChoice.equalsIgnoreCase(“C”))
{
tempLabel=“(C)”;
对于(int index=0;index
请发布具体的错误信息请显示您试图使用的实际代码以及完整的错误信息。不要重新表述,因为您的问题现在缺少重要信息(您可能没有意识到这一点很重要)@vandale:请回答这个问题。你想用什么除法?你可以像平常一样用数组来除法对象,例如anArray[3]/=5;又添加了两个错误。请发布具体的错误消息。请显示您尝试使用的实际代码以及完整的错误消息。不要重新表述,因为您的问题现在缺少重要信息(您可能没有意识到这一点很重要)@vandale:请回答这个问题。你想除以什么?你可以除以objec