答案 0 :(得分:1)
如果您可以在对话流中执行此操作。添加或替换JSON中的文本。
添加标记为 import javax.swing.*;
import java.util.*;
import java.util.Arrays;
public class statisticalModel
{
//Initates a place for the normal curve to be placed.
static double Ho;
//Real proportion of data statistic.
static double Ha;
//Estimated real proportion of data statistic.
static int Pop;
//Population size.
static int Zscore;
//Z score, or the amount of standard deviations away from the mean.
//Z score = sqrt(P(1-p)/N)
static int stdDev;
//Standard Deviation, follows the 65, 95, 99 model. 65 percent of all scores
//fall in one standard deviation of the mean. 95 percent of all scores fall
//within two standard deviations of the mean. 99 percent of all scores fall
//within three standard deviations of the mean.
static int mean;
//The average of all the scores of the array.
static double variance;
//The average difference between sets of values within the array.
static String desiredValue = "";
//This is a string set to the user's command. Tells whether or not the value should
//be lower than, higher than, or not equal to Ho.
static int[] meanScores = new int[100];
//Array meant to generate a set of random values within the normal curve of
//the model, following the 65, 95, 99 rule.
static Scanner sc =new Scanner(System.in);
//Scanner to take in values listed above.
static World wor ;
//Screen which the normal curve is printed on.
static int size;
//Variable that measures the size of the array.
static int temporary;
//Value Holder for For Loops, While Loops, If Statements, etc.
public static void main(String args[])
{
size = meanScores.length;
wor = new World(600,600);
Turtle cursor;
cursor = new Turtle(300, 500 ,wor);
runStatisticalMethod();
System.out.println(Arrays.toString(meanScores));
}
public static void runStatisticalMethod()
{
takeInData();
calculateStats();
generateCurve();
explainSolution();
}
public static void takeInData()
{
System.out.println("Please enter your desired Ho");
Ho = sc.nextDouble();
System.out.println("Please enter your desired Ha");
Ha = sc.nextDouble();
System.out.println("Please enter your desired population size");
Pop = sc.nextInt();
System.out.println("Thanks for entering your data. Your data will be compiled below");
}
//Generates a normal curve based on the data from calculateStats() and
//data entered by the user.
public static void generateCurve()
{
fillRandomArray();
//Functions as a cursor to draw the normal curve
for(int x = 0; x < 99; x++)
{
}
}
//Fills the array meanScores with random integers.
public static void fillRandomArray()
{
double x = 0.0;
while(x < 100.0)
{
(double)randomValue = (Math.random()*100);
meanScores[x] = randomValue;
meanScores[x]= meanScores[x]*(stdDev*(Math.random()*3));
x++;
}
assignStdDev();
for(double x = 0.0; x < 99.0; x++)
{
for(double y = 0.0; y < 99.0; y++)
{
if(meanScores[y] >= meanScores[y+1])
{
double valueHolder1 = meanScores[y];
double valueHolder2 = meanScores[y+1];
meanScores[y+1] = valueHolder1;
meanScores[y] = valueHolder2;
}
}
}
System.out.println("The following is a set of 100 random values which follow the normal curve of your hypothesis");
}
public static void assignStdDev()
{
for(int x = 5; x >=5 && x <=95; x++)
{
meanScores[x] = meanScores[x] - (int)(stdDev*Math.random());
}
for(int x = 31; x >= 31 && x < 66; x++)
{
meanScores[x] = meanScores[x] - (int)(stdDev*Math.random());
}
}
//Calculates a set of statistics including standard deviation, z-score, mean,
//interquartile range, probability, and variance.
public static void calculateStats()
{
//Calculates the Mean of the inputted variables and normal curve.
int sum = 0;
for(int a : meanScores)
{
sum += a;
}
mean = sum/size;
//Calculate the Variance of the inputted variables and normal curve.
for(int b :meanScores)
{
temporary += (b-mean)*(b-mean);
}
variance = temporary/size;
//Calculate the Standard Deviation of the inputted variables and normal curve.
stdDev = (int)Math.sqrt(variance);
}
//This method explains the numbers generated in terms of statistics and analyzes
//if the hypothesis is probably. If not, a possible solution is proposed with
//regards to what should be changed. Also explains the curve of the graph.
public static void explainSolution()
{
}
}
的网址和<a target>
您的网址内的网址。
检查我的示例(在对话流程中使用示例进行编辑):
href=
在this链接中查看更多内容。 我更详细地回答了同样的问题。
在您的回复中添加内容(非高级回复):
{
"output": {
"text": {
"values": [
"This is a link <a target=\\\"_blank\\\" href= \\\"https://www.choosemyplate.gov\\\">Food and nutrition Guide</a>.\\n<br/><br/>Talk to you later, bye for now!"
],
"selection_policy": "sequential"
}
}
}
如果您对此有更多疑问,请告诉我,我会尽力帮助您。