Answer:
see explaination
Explanation:
import java.util.InputMismatchException;
import java.util.Scanner;
public class calculate {
static float a=0,b=0;
double cal()
{
if(a==0||b==0)
{
System.out.println("no values found in a or b");
start();
}
double x=(a*a)+(b*b);
double h=Math.sqrt(x);
a=0;
b=0;
return h;
}
float enter()
{
float val=0;
try
{
System.out.println("Enter side");
Scanner sc1 = new Scanner(System.in);
val = sc1.nextFloat();
return val;
}
catch(InputMismatchException e)
{
System.out.println("Enter correct value");
}
return val;
}
void start()
{
calculate c=new calculate();
while(true)
{
System.out.println("Enter Command");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
switch(input)
{
case "A":
a=c.enter();
break;
case "B":
b=c.enter();
break;
case "C":
double res=c.cal();
System.out.println("Hypotenuse is : "+res);
break;
case "Q":
System.exit(0);
default:System.out.println("wrong command");
}
}
}
public static void main(String[] args) {
calculate c=new calculate();
c.start();
}
}
Answer:
- public class Main {
- public static void main(String[] args) {
- String testString = "abscacd";
-
- String evenStr = "";
- String oddStr = "";
-
- for(int i=testString.length() - 1; i >= 0; i--){
-
- if(i % 2 == 0){
- evenStr += testString.charAt(i);
- }
- else{
- oddStr += testString.charAt(i);
- }
- }
-
- System.out.println(evenStr + oddStr);
- }
- }
Explanation:
Firstly, let declare a variable testString to hold an input string "abscacd" (Line 1).
Next create another two String variable, evenStr and oddStr and initialize them with empty string (Line 5-6). These two variables will be used to hold the string at even index and odd index, respectively.
Next, we create a for loop that traverse the characters of the input string from the back by setting initial position index i to testString.length() - 1 (Line 8). Within the for-loop, create if and else block to check if the current index, i is divisible by 2, (i % 2 == 0), use the current i to get the character of the testString and join it with evenStr. Otherwise, join it with oddStr (Line 10 -14).
At last, we print the concatenated evenStr and oddStr (Line 18).
Answer:
thats really hard how could you answerthis hhhhhhh
Answer:
A. Manufacturers rating capacity ↔ 3. Must be marked on all jacks; must not be exceeded
B. Block Used to lift and hold heavy loads, allow them for travel ↔ 1. Place the jack head against this
C. Level surface ↔ 4. Place this under the base of the jack when it's necessary to provide a firm foundation
D. Jack ↔ 2. Used to lift and hold heavy loads, allow them for travel
Explanation:
The manufacturers rating for a jack is labelled on all jacks and should be referenced to compare with the load to be lifted so as to ensure a safe and successful lifting.
In order to lift a load, such as a car, it is required to place the jack on a level surface to provide balance during the lifting task
The head of the jack is placed against the block for lifting heavy objects for proper performance
Answer:
La probabilidad pedida es 
Explanation:
Sabemos que la probabilidad de que un nuevo producto tenga éxito es de 0.85. Sabemos también que se eligen 10 personas al azar y se les pregunta si comprarían el nuevo producto. Para responder a la pregunta, primero definiremos la siguiente variable aleatoria :
'' Número de personas que adquirirán el nuevo producto de 10 personas a las que se les preguntó ''
Ahora bien, si suponemos que la probabilidad de que el nuevo producto tenga éxito se mantiene constante
y además suponemos que hay independencia entre cada una de las personas al azar a las que se les preguntó ⇒ Podemos modelar a
como una variable aleatoria Binomial. Esto se escribe :
~
en donde
es el número de personas entrevistadas y
es la probabilidad de éxito (una persona adquiriendo el producto) en cada caso.
Utilizando los datos ⇒
~ 
La función de probabilidad de la variable aleatoria binomial es :
con 
Si reemplazamos los datos de la pregunta en la función de probabilidad obtenemos :
con 
Nos piden la probabilidad de que por lo menos 8 personas adquieran el nuevo producto, esto es :

Calculando
y
por separado y sumando, obtenemos que 