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.Enter integer:99Enter double:3.77Enter character:zEnter string:Howdy99 3.77 z Howdyimport java.util.Scanner;public class BasicInput {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int userInt;double userDouble;// FIXME Define char and string variables similarlySystem.out.println("Enter integer:");userInt = scnr.nextInt();// FIXME (1): Finish reading other items into variables, then output the four values on a single line separated by a space

Answers

Answer 1

Answer:

import java.util.Scanner;

public class BasicInput {

   public static void main(String[] args) {

       //Create an object of the Scanner class

       Scanner scnr = new Scanner(System.in);

       

       //Define int and double variables

       int userInt;

       double userDouble;

       

       //Define char and string variables similarly

       char userChar;

       String userString;

       

       //Prompt the user to enter an integer

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

       //Store the input in the integer variable

       userInt = scnr.nextInt();

       

       //Prompt the user to enter a double

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

       //Store the input in the double variable

      userDouble = scnr.nextDouble();

       

       //Prompt the user to enter a char

        System.out.println("Enter char:");

       //Store the input in the char variable

      userChar = scnr.next().charAt(0);

       

       //Prompt the user to enter a string

        System.out.println("Enter String:");

       //Store the input in the string variable

      userString = scnr.next();

       

       //Output the four values on a single line

       //separated by a space

       System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString);

       

   }

   

}

Sample Output:

Enter integer:

>>12

Enter double:

>>23

Enter char:

>>s

Enter String:

>>asdasd

12 23.0 s asdasd

Explanation:

The code above has been written in Java. It contains comments explaining every part of the code. Please go through the comments.


Related Questions

Write a program that allows two players to play a game of tic-tac-toe. Use a two dimensional char array with three rows and three columns as the game board. Each element of the array should be initialized with an asterisk (*). The program should run a loop that - Displays the contents of the board array - Allows player 1 to select a location on the board for an X. The program should ask the user to enter the row and column number. - Allows player 2 to select a location on the board for an O. The program should ask the user to enter the row and column number. - Determines whether a player has won, or a tie has occurred. If a player has won, the program should declare that player the winner and end. If a tie has occurred, the program should say so and end. Player 1 wins when there are three Xs in a row on the game board. The Xs can appear in a row, in a column, or diagonally across the board. A tie occurs when all of the locations on the board are full, but there is no winner.
You need to code programing challange question 18 (Tic Tac Toe Game) from Chapter 7 and add following feature in it.
1. Add two playing options. That is player can play with other player or with computer.
2. Add difficulty level (Easy, Medium and Hard) when playing against computer.
3. You should store the history of game results in a file and whenever game start you should load the history from the file.
4. Your game should present following menu.

Game Menu

1. Play
2. Game Results
3. Quit

If user select 1 then following menu should be shown

1. Play with Computer
2. Play with Other Player
3. Go Back

If user selects 3 then you should go back and display previous menu screen.
If user selects 1 the show following menu

Please select difficulty
1. Easy
2. Medium
3. Hard
4. Go Back

When user selects the desired difficulty then you should take the username (first and last name) from the user start the game
and user should be able to play with computer. Keep in mind in Easy difficulty level player should be able to easily beat the
computer where as in hard difficulty it should be very difficult for player to win.
Once game has been finished store the result in a file (You can give whatever name you want to) in following format

Name, Opponent Name, Winner, Date

For example if Majid Ali played game against computer with medium level and he wins then file should contain record as following

Majid Ali, Computer, Majid Ali, Medium, 22-August-2020

For example if Majid Ali played game against Hamza Abbas and Hamza wins then file should contain record as following

Majid Ali, Hamza Abbas, Hamza Abbas, None, 20-August-2020

When user selects 'Game Results' from the main menu then all the contents you saved in the file should be display to the screen in following format

Player 1 Player2 Winner Level Date
================================================
Majid Ali Computer Majid Ali Medium 22-August-2020
Majid Ali Hamza Abbas Hamza Abbas None 22-August-2020

Please do proper input validation at each level.

Answers

Answer:

Explanation:

i think it is easy:

1- you declare 2d array

2- fill it with *

3- declare player1Turn =true

4- declare player2Turn =false

5- make while loop where not finished

BS:not Finished would be function return bool that checks the condtions

6-if player1Turn

6.1- player1Turn =false

6.2- player2Turn =true

6.3- call function called play with "player1","X" as args

6-else if player2Turn

6.1- player2Turn =false

6.2- player1Turn =true

6.3- call function called play with "player2","O" as args

5- end while loop

In addition to talking to other doctors remotely, telegraphy technology?

Answers

Answer:

Option A

Explanation:

it lets the doctors to talk to their patients about their concerns and the doctor will try to help them or make a diagnosis using the information given by the patient.

No one should self diagnose using the internet.

sometimes in order to confirm their diagnosis the doctor will require you to take certain tests,thus telehealth does not eliminate the need to visit the doctor.

Answer:

allows patients and doctors to talk online.

Which of the following types of e-commerce presence is best suited for creating an ongoing conversation with one's customers?A) Web site. B) E-mail. C) Social media.D) Offline media.

Answers

Answer:

C) Social media

Explanation:

Social media is a vital marketing tool in the modern era. Aside from posting photos or status updates, using social media for customer service can elevate your business to the next level. Social media has strong potential to better address customer service issues. And if you address and resolve customer concerns over social media in short enough time, the exchange can help you create a loyal customer base.

Angelina, the outgoing student body president, has finished a report about the upcoming school election. She wants to add a border to her report. First, Angelina navigates to the Design tab and then to the

Answers

Answer:

✅ Page background

✅ Page Borders

✅ Color

Explanation:

EDGE 2022

First, Angelina should navigate to the Design tab of the Word document and then to the Page background.

What is Microsoft Word?

Microsoft Word refers to a word-processing software application that is designed and developed by Microsoft Inc., so as to avail its end users an ability to type, format, adjust and save text-based documents.

In this scenario, Angelina can adjust the presentation of her Word document as follows:

Angelina should first, navigate to the Design tab of the Word document and then to the Page background.Next, she should click on the Page Borders.Finally, she should choose the style, width, and color of the border.

Read more on Microsoft Word here: https://brainly.com/question/25813601

#SPJ2

A business would use a website analytics tool for all of the following EXCEPT _____.
A. viewing the number of pages a person visited
B. viewing the number of new and returning visitors
C. viewing why someone visited your webpage
D. deciding when to increase bandwidth

Answers

Answer:

C. viewing why someone visited your webpage

Explanation:

Website analysis often referred to as Web analytics is a term that is used to describe a form of website distribution, activity, and proportion relating to its performance and functionality.

Some of the things Web analytics does include the following:

1.  measures the number of pages a user or visitor viewed or assessed

2.  counts the number of new and returning visitors

3.  helps website administrator to know when to increase bandwidth

Hence, in this case, the correct answer is option C. viewing why someone visited your webpage

During the Inspect and Adapt event, how are reflection, data collection, problem solving, and identification of improvement actions used?

Answers

Hello. This question is incomplete. The full question is:

During the Inspect and Adapt event, how are a reflection, data collection, problem-solving, and identification of improvement actions used?

a. To help the team bond and work more efficiently together

b. To enhance and improve the innovation and planning processes

c. To evalutate better implementation steps

d. To increase the quality and reliability of the next PI

Answer:

d. To increase the quality and reliability of the next PI

Explanation:

During the event Inspect and adapt, reflection, data collection, problem solving and identification of improvement actions are used to increase the quality and reliability of the next IP. This allows the organization and establishment of a high quality IP with considerable efficiency that will allow a good functioning of the system and the optimization of its reliability, because it allows possible problems to be located and resolved quickly, leaving the exit free and functional.

How to find the largest number in an array java?

Answers

Answer:

One of the ways is to sort the array, then print the last element of the sorted array.

In Java, you can make use of the following code

import java.util.Scanner;

public class Assignment{

public static void main(String [] args)

{

int n;

Scanner input = new Scanner(System.in);

System.out.print("Array Length: ");

n = input.nextInt();

int [] myarray = new int[n];

System.out.print("Input Array: ");

for(int i=0;i<n;i++)

{

           myarray[i]=input.nextInt();

}

int temp;  

for (int i = 0; i < n; i++)  

       {  

           for (int j = i + 1; j < n; j++)  

           {  

               if (myarray[i] > myarray[j])  

               {  

                   temp = myarray[i];  

                   myarray[i] = myarray[j];  

                   myarray[j] = temp;  

               }  

           }  

       }  

           System.out.println(myarray[n - 1]);

       }

}

Explanation:

This line declares n as length of array

int n;

Scanner input = new Scanner(System.in);

This line prompts user length of array

System.out.print("Array Length: ");

This line gets the user input

n = input.nextInt();

An empty array pf length arrowed

int [] myarray = new int[n];

This line prompts user array elements

System.out.print("Input Array: ");

The following iteration gets array element from user

for(int i=0;i<n;i++)

{

           myarray[i]=input.nextInt();

}

This line declares a temporary variable temp

int temp;

This iterations iterates through the elements of rge array

for (int i = 0; i < n; i++)  

       {  

           for (int j = i + 1; j < n; j++)  

           {  

The following if condition checks for the larger of two variables and swap their position

               if (myarray[i] > myarray[j])  

               {  

                   temp = myarray[i];  

                   myarray[i] = myarray[j];  

                   myarray[j] = temp;  

               }  

           }  

       }  

This line prints the largest number of the array

           System.out.println(myarray[n - 1]);

which criteria can cuboids/frame selectors be coloured by​

Answers

Answer:

Label

Rider attribute

Parked attribute

Reverse Light attribute

Indicator Status attribute

Brake Light attribute

Vehicle Towing attribute

Cuboid ID

Any Lights attribute

Bottom Z

Occlusion attribute

Fifty part-time students were asked how many courses they were taking this term. The (incomplete) results are shown below. Need answers for part B and C

Answers

Answer:

The answer for B is 10% and for C is 40%.

Explanation:

To get the percentage for B you take the the frequecy of students taking 2 courses (5) and multiply it by 100 then you divide it by whole number of students.

For C you do the after adding the number of students taking 1 or 2 courses (20).

Here is source code of the Python Program to multiply all the items in a dictionary. The program output is also shown below.d={'A':10,'B':10,'C':239}tot=1for i in d: tot=tot*d[i]print(tot)

Answers

Answer:

Following are the output to this question:

Output:

23900

please find the code in the attachment file.

Explanation:

In the above-given Python code, a dictionary "d" is defined, that holds key and values, in the next step, the "tot" an integer variable is defined, that holds a value "1".

In the next step, for loop is defined, that uses the "tot" variable to multiply the dictionary value and store its value.

Outside the loop, the print method is used, that prints its values.  

How to chnage email adresss on slate from tophat?

Answers

Answer:

First visit the Tophat website on https://tophatblue.com.

To access and manage your Slate account on Slate:

Log in to the server with your username and password. Click your profile picture or your initials and select My Account and then select Profile.

Under the profile, you will see the following profile information: You can verify and edit them.

- Name

- Username

- Email

- Set a new password

To verify or edit your email address, click Email.

Upon verification of your email by the Slate server, a check appears alongside it.

Should you need another verification email, select the Verify email option.

1.1.5 practice: analyzing business culture

a. Recall what you have learned about positive culture and business practices in this lesson. With an

understanding that some things must change with company X, discuss ways in which Company X can

still focus on making changes but also focus on keeping positive culture practices while these changes

are being made. (1 point)

Answers

Answer:

 

A positive culture is an advantage when changes need to be made in the company. Making organisational changes and maintaining a positive culture a mutually complementary rather than mutually exclusive.

In a positive culture environment, people are happy and feel valued. When people feel happy and valued, it makes it easy for management to garner their buy-in cooperation when changes need to be made within the business.

In a culture that is negative, people don't feel valued and as such are always after their own interest rather than that of the company. There is also a tendency to always be on the defensive side of any change that is about to come looking out for one's self rather than what is best for the collective good. In this case, staff are much likely to sabotage new initiatives and changes rather than work to actuate them.

The obverse is true for a business with a positive culture.

Cheers!

What are some common options to sort a Mail Merge Recipient list?​

Answers

Answer:

Create and save the main document.

On the Mailings tab, in the Start Mail Merge group, choose Select Recipients→Type a New List.

Click the Customize Columns button.

Select a field that you do not need.

Click the Delete button.

Click Yes in the confirmation dialog box.

Explanation:

Hope it is helpful for you

please follow me and mark me as a brainest

Answer:

a Safe Recipients list or a postmark

Explanation:

What are some of the shortcomings of antivirus software today?

Answers

Answer:

The answer is below

Explanation:

There are various shortcomings of antivirus software today, some of which are:

1.  Endless Upgrade system: today's antivirus requires users to upgrade every now and then,

2.  Excessive Ads: there are too much and unnecessary advertisements on the software

3.  It takes a longer time to perform scans.

4.  Some antivirus shares users' computer usage data online, which can be considered as an invasion of privacy.

5.  Some lack superior scanning operation.

Assume for arithmetic, load/store and branch instructions a process has CPIs of 1.3, 14.9 and 5.4. On 1 processor the program will require 3*10^9 arithmetic instructions, 1.6*10^9 load/store instructions and 2*10^6 branch instructions. Assume that the processor has a 7GHz clock frequency. Assume that, as the program is parallelized to run over multiple cores, the number of arithmetic and load/store instructions per processor is divided by 0.7 x p (where p is the number of processors) but the number of branch instructions per processor remains the same. If there are 6 processors, what's the total execution time in milliseconds (you'll need to multiply your answer by 1000) (Your answer should a WHOLE NUMBER round up from 0.5, round down otherwise)

Answers

Answer:

the answer is the middle of a butt whole

Explanation:

Which of the following is true of public methods?
A) They can only be accessed by methods in the same package
B) They can only be accessed by methods in the same class
C) They can only be accessed by methods in a different package
D) They can be accessed by any method in the same program

Answers

Answer:

D) They can be accessed by any method in the same program

Explanation:

Public methods is a form of access modifier in a programming language such as Java, Phython, C#. However, unlike other types of access modifiers like Private Methods, Protected Methods etc they do not put any form of restriction on the access. Hence, in Public Methods members, methods and classes can be accessed from anywhere.

Therefore, what is true of Public Methods is that, they can be accessed by any method in the same program

What term describes the statements that a programmer writes in a high-level language?

Answers

Answer:

A compiler is a computer program that translates a program written in a high-level language to the machine language of a computer. The high-level program is referred to as 'the source code.

Steps for assessing the tabs dialog box

Answers

Answer:

A dialog box what that

Explanation:

sorry 1 c3 your times 5

One of the simplest hashing algorithms involves dividing the primary key field by a particular ____.

Answers

Answer:

Prime number

Explanation:

Hashing algorithm is a computer engineering term that describes a function that develops or transforms an inputs data value into a fixed-size length numeric value output. The output string is typically smaller in comparison with the input data.

However, one of the simplest hashing algorithms involves dividing the primary key field by a particular Prime Number. This is because there is a high tendency of avoiding a crash while also acquiring a distinct output.

Hence, the correct answer is PRIME NUMBER.

Which of the following is not an advantage of a flowchart?
a) Better communication
b) Efficient coding
c) Systematic testing
d) Improper documentation

Answers

Answer:

d) Improper documentation

Explanation:

A flowchart is a type of diagram in which it presents the flow of the work or how the process is to be followed. It is a diagram that represents an algorithm that defines step by step approach to solving the task. In this, there are various boxes that are linked with the arrows

There are various advantages like in this, there is a better communication, coding is to be done in an efficient way, system could be tested also there is a proper documentation

hence, the correct option is d

Which of the following is not an advantage of a flowchart?

a) Better communication

b) Efficient coding

c) Systematic testing

d) Improper documentation

____ means saving data in computer memory.

Answers

Answer: Storage

Explanation:

Storage means means saving data in computer memory. Memory refers to the location which is meant for short-term data, while storage is the part of the computer system that allows an individual to store and also access data on long-term basis.

It should be noted that typically, storage usually comes in form of a hard drive or a solid-state drive.

What is the output for the following code? Enter the result in the blank.

>>> num = "abcdefghi"

>>> num[2:5]

Answers

Answer:

Cde

Explanation:

Because if you look at abcdefghi, In programming you start with 0. So it would be a:0 b:1 c:2 d:3 e:4 f:5 g:6 h:7 i:8. So if you say 2:5, it would be from c to e. Because in programming you dont count the last letter which is 5 you use the letter right before 5 to end it. Sorry its a bit confusing. But im 100% sure its right.

Answer:cde

Explanation:this is the correction on odyssey!!

Which statements reflect your experience with studying? Check all that apply.

Answers

Answer:

The end of an experience is a great time to reflect on your learning. With every research experience you will gain new skills, learn more about the type of environment you enjoy being in, further explore your strengths and interests, and test out your motivation to further study or pursue a career in a field or discipline.

Explanation:

For an activity with more than one immediate predecessor activity, which of the following is used to compute its earliest finish (EF) time? a. the largest EF among the immediate predecessors b. the average EF among the immediate predecessors c. the largest LF among the immediate predecessors d. the difference in EF among the immediate predecessors

Answers

Answer:

The correct option is A

Explanation:

In project management, earliest finish time for activity A refers to the earliest start time for succeeding activities such as B and C to start.

Assume that activities A and B comes before C, the earliest finish time for C can be arrived at by computing the earliest start-finish (critical path) of the activity with the largest EF.

That is, if two activities (A and B) come before activity C, one can estimate how long it's going to take to complete activity C if ones knows how long activity B will take (being the activity with the largest earliest finish time).

Cheers!

The option that will be used to compute its earliest finish time is A. the largest EF among the immediate predecessors.

The earliest finish time simply means the possible earliest times when an individual can be able to complete an assigned activity or project.

For an activity with more than one immediate predecessor activity, to compute its earliest finish time will be the largest EF among the immediate predecessors.

Read related link on:

https://brainly.com/question/17453686

Which OS function does a CLI fulfill? A User interface B Running applications C Hardware interface D Booting

Answers

Answer:

User Interface

Explanation:

The function of OS in the CLI is to form the user interface. Thus, option A is correct.

What is Command Line Interface (CLI)?

The command line interface is given as the application interface that has been used for the purpose of running the program, managing the files, and interacting with the computer system.

The operating system (OS) in the CLI performs the major function of following the link with the interface between the system and the user. Therefore, the function of OS in CLI is the user interface. Thus, option A is correct.

Learn more about the command-line interface, here:

https://brainly.com/question/14298740

#SPJ2

What file format can excel save files as

Answers

Answer:

.xlxs

but it supports pretty much any spreadsheet format.

which of these outcomes become more likely for someone with strong personal finance skills

Answers

Answer:

give me the outcomes

Explanation:

be a banker if thats your skill

Why would an administrator want to use the MAP Toolkit? Which tasks, other than the ones performed in this exercise, can administrators use the MAP TOOLKIT TO PERFORM?

Answers

Answer:

The MAP TOOLKIT is used to inventory the Microsoft computer devices in a network to check its readiness for upgrade and for mapping the utilisation of computer servers.

Explanation:

The Microsoft Assessment and Planning toolkit plays a vital role in the work of an IT administrator as it is automatic in inventory the users, devices and applications used in a computer network. It creates a mysql database as a default setup and is used to locate and upgrade servers in a network by analysing it's utilisation in the network.

Sanjay is giving a slideshow presentation on his entire college class and he is feeling quite nervous in order to share his presentation with the class he is trying to connect a cable from his computer to the larger video output screen but Sanjay his hands are shaking so badly from nerves that he is having trouble plug in the cable until what part of his computer the port the disk drive the cabling the hard disk Drive

Answers

I think that would be the (HDD) Hard Disk Drive! Hope this helps!

In real-world environments, risks and their direct consequences will most likely span across several domains. However, you selected only the domain that would be most affected. What was the primary domain impacted by the risk, threat, and vulnerability?

Answers

Answer: LAN to WAN domain

Explanation:

The following are the common threats to LAN to WAN domain:

Unauthorized port scanning.

Unauthorized probing.

The vulnerability of operating system, internet protocol, router, and firewall.

Vulnerable to malicious attacks.

Vulnerable to denial of service attack.

Vulnerable to network trafficking.

Vulnerable to theft of information and data.

Remote data gets compromised.

Other Questions
Jurisdiction M imposes an individual income tax based on the following schedule.RateIncome bracket5% $-0- to $50,000+ 8%$50,001 to $200,000+ 12%$200,001 and aboveWhich of the following statements is true?A) The schedule provides no information as to whether Jurisdiction M's tax is horizontally equitable.B) Jurisdiction M's tax is vertically equitable.C) Jurisdiction M's tax is vertically equitable only for individuals with $50,000 or less taxable income.D) Both A. and B. are true. The chemical reactions that take place in a cell, as compared to the chemistry in nonliving matter, primarily occur:________a. between simple moleculesb. in a hydrophobic environmentc. in extreme temperaturesd. between carbon-based molecules In a desert ecosystem, coyotes and rattlesnakes both eat the same type of mouse as a primary part of their diets. Recently, coyotes have been hunted and killed by people, decreasing the overall coyote population. 1. IV+61-6=6Solving absolute value? Also I beg you to forgive it me If I overlooked all standing and degree As regards the order in which people come Here in this tally, as I set them down: My wits are none too bright, as you can see. The Canterbury Tales, In this passage, how does the narrator reveal that he is unreliable? The narrator implies that he is suffering from madness. The narrator admits that he likes to exaggerate and brag. The narrator tells his audience that he is unintelligent and careless. The narrator confesses that he never met the people in the story. The standard deviation of Erics data is 0.8C. Martha conducted the same experiment. Her average temperature was 35.1 with a standard deviation of 1.2C. Her data are more precise than Eric's John Maynard Keynes and Adam Smith would disagree most about theanswer to which question?A. Is it right for large countries to control weaker colonies?B. Should workers unite to create a command economy?C. Is unemployment a problem in free market systems?O D. Should governments actively regulate their economies? Can someone please help me w these chemistry conversion? 1. The density of Mercury is 13.6 g/mL. What is the volume of mercury, in quarts has a mass of 95.0 ounces? 2. Tetrachloroethylene, also called PERC, has a density of 1.62 g/mL. It was formerly used as a dry cleaning solvent. What is the mass in pounds of PERC contained in a 55.0 gallon drum? 3. Osmium is the most dense element having a density of 22.5 g/cm^3 Calculate the density of osmium in kg/m^3. 4. The density of Iron is 7.50 g/cm^3. What is the mass, in pounds, of a cube of iron that measures 5.00 cm on a side? 5. Lead has a density of 10.5 g/cm^3. What is the diameter of a lead ball that has a mass of 500.0 g? Report answer in cm. A government will use a(n) _____ to attempt to control the export of national treasures or antiques. find the total pay for the week $12.50 per hour time and a half for sunday hours worked day must be rounded to the nearest quarter hour. How is a Standing Committee different from theGeneral Assembly?AA Standing Committee is responsible fordrafting legislation while the GeneralAssembly is responsible for amending it.B.A Standing Committee is responsible forstudying and discussing legislation while theGeneral Assembly is responsible fororiginating itA Standing Committee is responsible forvoting on legislation while the GeneralAssembly is responsible for overriding vetoes.DA Standing Committee is responsible foramending legislation while the GeneralAssembly is responsible for approving it Questions in the picture. Pls help!!!!! 4. How does fear drive action? What did Mary Maloney fear most and how did it affect her actions? Today, you worked from 7am to 4pm. The state you live in requires that you take a 30-minute break during any shift longer than 6 hours. This break does not count towards your hours. How many hours did you work today? Remember, 30 minutes is equal to .5 hours. This was the legislative body established in colonial America, it was based on a democratic voting system. A.) Continental Congress B.) Mayflower compact C.) House of Burgesse D.) Jamestown Charter The ratio of yellow to blue skittles in a bag 5:9 if there are 12 more blue skittles in the bag than yellow skittles how many yellow skittles are in the bag importance of price elasticity of demand in business Danny is trying to determine the product between a rational and irrational number what's is a correct format of the website links Henry needs 2 pints of red paint and 3 pints of yellow paint to get a specific shade orange. If he uses 9 pints of yellow paint and wants the same orange color, how many pints of paint will he need altogether. Explain how you know