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
KonstantinChe [14]
3 years ago
11

(1) Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output

those four values on a single line separated by a space. (2 pts) Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs. Enter integer: 99 Enter double: 3.77 Enter character: 2 Enter string: Howdy 99 3.77 z Howdy (2) Extend to also output in reverse (1 pt) Enter integer: 99 Enter double 3.77 Enter characteri Enter string: Howdy 99 3.772 Howdy Howdy z 3.77 99 (3) Extend to cast the double to an integer, and output that integer (2 pts) 0 en soa Enter integer: 99 Enter double: 3.77 Enter character: 2 Enter string: Howdy 99 3.77 z Howdy Howdy z 3.77 99 3.77 cast to an integer is 3 LAB ACTIVITY 14.1.1: Prog 1: Variables, input, and casting 0/5 BasicInput.java Load default template. 1 ort java.util.Scanner: 2 3 lic class Basic Input I 4 public static void main(String args) { 5 Scanner ser-new Scanner(System.in); 6 int userint; 7 double userDouble; B // FTOME Define chor and string variables similarly 9 char UserChar: 10 String userString: 11 12 System.out.println("Enter integer"): 13 user Int - ser.nextInto: 14 15 // FTXMC (1): Finish reading other items inte variables, then output the four values on a single line separated by a space
Computers and Technology
1 answer:
Alex787 [66]3 years ago
6 0

Answer:

import java.util.*;

public class Main{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int intgVal; double dblVal; char chrVal; String strVal;

 System.out.print("Enter integer: ");  

 intgVal = input.nextInt();

 System.out.print("Enter double: ");  

 dblVal = input.nextDouble();

 System.out.print("Enter character: ");  

 chrVal = input.next().charAt(0);

 input.nextLine();

 System.out.print("Enter string: ");  

 strVal = input.nextLine();

 System.out.println(intgVal+" "+dblVal+" "+chrVal+" "+strVal);

 System.out.println(strVal+" "+chrVal+" "+dblVal+" "+intgVal);

 int IntValue = (int) dblVal;

 System.out.print("Cast to an integer: "+IntValue);

}

}

Explanation:

See attachment for complete program where comments were used to explain each line of the program

Download txt
You might be interested in
You connect three 0.5 volt lights in series. Each light has a resistance of 25ohms. Answer the following.
viktelen [127]
1. 3 times the light voltage, ie., 3*0.5 = 1.5V
2. Total R = 3*25 = 75Ω, V=1.5V, I = V/R = 1.5/75 = 20 mA
3. A 1.5V battery (e.g., an AA battery) with a charge of at least 20mAh. AA batteries should be able to handle this easily.
7 0
4 years ago
Suppose you are a merchant and you decide to use a biometric fingerprint device to authenticate people who make credit card purc
luda_lava [24]

Answer:

i dont know the answer

Explanation:

3 0
3 years ago
What is some effective writing techniques?
scoray [572]
Be persuasive, have form, and know what you are talking about. I would recommend using MELCON.  You can learn more about MELCON with this link.  http://melcon.weebly.com/
3 0
3 years ago
If you need to multiply 50 and 8 and divide by 2, what would you type on the numerlc keypad?
nata0808 [166]

Answer:

50*8/2

The asterisk is the multiplication sign and the parenthesis is the division.

I've never used an apostrophe for a multiplication sign before, but I'm guessing multiplication is what it stands for.

Explanation:

4 0
3 years ago
Angelika just submitted her product for the first time, and she had 2 errors, 3 warnings, and 5 notifications. What does she nee
KonstantinChe [14]

Answer:

Errors.

Explanation:

Angelika should focus on fixing the errors so that her ads can be shown. Because of the errors the code will not compile fully either be it run time error or compile time error or syntax error or any other error.

Warnings shows the potential problems but the code will run even if there are warnings and the notifications are not to worry about.

4 0
3 years ago
Other questions:
  • Each character in a string has a(n) _______________ which specifies its position in the string.
    13·1 answer
  • What does confidentiality of data refer to?
    6·2 answers
  • . How are returnspredicted in modern microprocessors?
    9·1 answer
  • Que es lo que me recomiendan estudiar? :v
    10·1 answer
  • What information should you avoid sharing when updating your status?
    14·2 answers
  • An internal control system is used to do all of the following: (You may select more than one answer. Single click the box with t
    11·1 answer
  • Which philosopher believed that if we carefully examine the contents of our experience, we find that there are only two distinct
    10·1 answer
  • Witch of the following is a malicious program that can replicate and spread from computer to computer?
    13·1 answer
  • If you convinced your teacher to give you an extension on an assignment, what would this situation be an example of? OA. General
    8·1 answer
  • What is text formatting/
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!