Answer:
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader brObject = new BufferedReader(new InputStreamReader(System.in));
String str;
while ((str = brObject.readLine()) != null) {
int number = Integer.parseInt(str);
System.out.println(number * number);
}
}
}
Explanation:
- Inside the main method, create an object of BufferedReader class to read lines from standard input.
- Declare a string and run a while loop until it reaches the end of the input.
- Inside the while loop convert the string into an integer data type.
- Finally display the output by squaring the number.
Answer:
I did not understand a thing from your writing
Answer:
Explanation:
import java.Util;
public class Eggs{
public static void main (String [] args)
{
int noOfEggs, dozen, units;
float total;
Scanner input = new Scanner(System.in);
noOfEggs = input.nextInt();
if(noOfEggs < 0)
{
System.out.print("Invalid");
}
else
{
if(noOfEggs >= 12)
{
dozen = noOfEggs/12;
units = noOfEggs % 12;
}
else
{
dozen = 0;
units = noOfEggs;
}
total = dozen * 3.25 + (units * 45)/100;
System.out.print("You ordered "+noOfEggs+" eggs.\n");
System.out.print("That's "+dozen+" dozen at $3.25 per dozen and "+units+" loose eggs at 45 cents each for a total of $"+total);
}
}
}
It would take 2 consultants 30 hours to create a slide deck of 120 slides.
Explanation:
Rate of slide making by one consultant- 2 slides per hour
Target- 120 slides
2 consultants are employed in the job-
Since 2 consultants are employed in the job, total rate of making slides per hour would be 4 slides/hour (2*2 slides/hour)
Time required to complete 120 slides= total slides/rate of doing slides per hour
Substituting the values, we get
Time required= 120/4= 30 hours
Hence, it would take 30 hours for 2 consultants to create a slide deck of 120 slides.