1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NikAS [45]
4 years ago
3

2.18 LAB: Warm up: Variables, input, and type conversion (1) Prompt the user to input an integer between 32 and 126, a float, a

character, and a string, storing each into separate variables. Then, output those four values on a single line separated by a space. (Submit for 2 points).
Engineering
1 answer:
shutvik [7]4 years ago
8 0

Answer:

The solution code is written in Java.

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Enter an integer between 32 - 126: ");
  6.        int data1 = input.nextInt();
  7.        System.out.print("Enter a floating point number: ");
  8.        double data2 = input.nextDouble();
  9.        System.out.print("Enter a character: ");
  10.        char data3 = input.next().charAt(0);
  11.        input.nextLine();
  12.        
  13.        System.out.print("Enter a string: ");
  14.        String data4 = input.nextLine();
  15.        System.out.println(data1 + " " + data2 + " " + data3 + " " + data4);
  16.    }
  17. }

Explanation:

Since we need user input, we create a Scanner object (Line 7). Then we can start using the Scanner object to prompt user to input the integer, float, character and string (Line 8 - 20). Please note that we have to use four different input methods, nextInt(), nextDouble(), next().charAt(0) and nextLine(), to get the user input with four different data types and store them into their respective variables.

We can use println() method to print the four values in one line (Line 22) through string concatenation. Whenever a value is joined with a string (e.g. a single space " ") using the + operator, the value will be converted to string regardless its original type is integer, float or character.

You might be interested in
Two balls are chosen randomly from an urn containing 8 white 4 black, and orange balls. Suppose that we win $ 2 for each black b
Scorpion4ik [409]
(-2,-10,-1,-2,-3,-4)
8 0
3 years ago
Select three functions of catalysts.
Korolek [52]

Answer: speed up food processing

speed up plant growth

Increase fuel efficiency

Explanation:

A catalyst simply refers to a substance that leads to an increase in the reaction rate when it's added to a substance. When the activation energy is reduced by catalysts, this.hwlpa on the speeding up of a reaction.

Therefore,the functions of catalysts include speed up food processing, speeding up plant growth and increase fuel efficiency

5 0
3 years ago
As temperature decreases a batteries availability power what
SSSSS [86.1K]
The answer is increases because when something like that decreases it’s always decreasing that probly makes no sense Imao but it’s increases
7 0
3 years ago
How did technology change society in the Renaissance?
WINSTONCH [101]
I think it’s A


Hope I helped
8 0
3 years ago
Read 2 more answers
a cantilever beam 1.5m long has a square box cross section with the outer width and height being 100mm and a wall thickness of 8
djverab [1.8K]

Answer:

a) 159.07 MPa

b) 10.45 MPa

c) 79.535 MPa

Explanation:

Given data :

length of cantilever beam = 1.5m

outer width and height = 100 mm

wall thickness = 8mm

uniform load carried by beam  along entire length= 6.5 kN/m

concentrated force at free end = 4kN

first we  determine these values :

Mmax = ( 6.5 *(1.5) * (1.5/2) + 4 * 1.5 ) = 13312.5 N.m

Vmax = ( 6.5 * (1.5) + 4 ) = 13750 N

A) determine max bending stress

б = \frac{MC}{I}  =  \frac{13312.5 ( 0.112)}{1/12(0.1^4-0.084^4)}  =  159.07 MPa

B) Determine max transverse shear stress

attached below

   ζ = 10.45 MPa

C) Determine max shear stress in the beam

This occurs at the top of the beam or at the centroidal axis

hence max stress in the beam =  159.07 / 2 = 79.535 MPa  

attached below is the remaining solution

6 0
3 years ago
Other questions:
  • Make a proposal to add a small pizza shop to a historical part of town. How could it be designed to “fit” into the area?
    7·2 answers
  • The step shaft is subjected to a torque of 710 lb·in. If the allowable shear stress for the material is τallow = 12 ksi, determi
    11·1 answer
  • Rehoboam reigned in Jerusalem over the tribes of
    9·1 answer
  • The main function of diversified investments is to:
    6·2 answers
  • An aircraft component is fabricated from an aluminum alloy that has a plane strain fracture toughness of 30 . It has been determ
    5·1 answer
  • a circular pile, 19 m long is driven into a homogeneous sand layer. The piles width is 0.5 m. The standard penetration resistanc
    6·1 answer
  • Which of the following can effect LRO?
    12·1 answer
  • Based on your client's request, you will now create a sketch model of your designed pet toy. You will use your technical sketch
    7·1 answer
  • This graph shows the US unemployment rate from<br> August 2010 to November 2011
    12·1 answer
  • When a system of force acts on a point and stays in rest the forces are in​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!