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]
4 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]4 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
What is the purpose of a computer virus? O to spread a disease to humans O to substitute for a human disease a O to disrupt a co
Ivahew [28]

Answer:

to disrupt a computer

Explanation:

3 0
3 years ago
Brief description email etiquette​
Solnce55 [7]

Answer: See explanation

Explanation:

Email etiquette is defined as the code of conduct which helps to guide the behavior when people send or respond to emails. Some of ail etiquette include:

• Using proper and correct grammar and punctuations.

• Replying quickly too emails.

• Including a clear and direct subject.

• Proofreading of messages.

• Cautious with humour.

• Sending of smaller files and compressing large files.

7 0
3 years ago
Create a Java program that will store 10 student objects in an ArrayList, ArrayList. A student object consists of the following
Crank

Answer:

Following is given the detailed java program as needed.

Last image displays the output of the program

I hope it will help you!

Explanation:

5 0
3 years ago
What Internet access method would be suitable for a business requiring a high bandwidth connection where no cabled options exist
34kurt

Answer:

Fiber Optic, it allows for speeds up to 1200 mbps

Explanation:

4 0
3 years ago
You have an insurance policy with a $300 premium and a $500 deductible. How much should you expect to pay the insurance company
Assoli18 [71]
200$ it's easy 500-300
4 0
3 years ago
Other questions:
  • 1. Which markup language adds the ability to use video without requiring the user to download add-ons?
    13·1 answer
  • What determines the choice of a rocket for a mission?
    11·1 answer
  • The keyboard usually has six rows of keys. Which of the following is not one of the key group categories?
    7·2 answers
  • 5.19 LAB: Countdown until matching digits Write a program that takes in an integer in the range 20-98 as input. The output is a
    14·1 answer
  • Which of the following makes a virtual tour different from a printed map
    6·2 answers
  • Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.
    15·1 answer
  • You are evaluating three branch prediction strategies: (1) predict always taken, (2) predict always not taken and (3) use the 2-
    14·1 answer
  • While using a web-based order form, an attacker enters an unusually large value in the Quantity field. The value he or she enter
    15·1 answer
  • The backbone networks of the Internet are typically owned by long-distance telephone companies called
    12·1 answer
  • When you are typing data that is in a series, such as days of the week or months of the year, you can use this tool to complete
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!