Short Answer
Write a program that uses the Scanner to ask the user for an integer, but forces the user to repeatedly re-enter the number until they enter a negative value.
Then if the number is odd, print it out. Otherwise, check if the number is less than -10 and if so, print it out twice.
For example:
4 you would be forced to re-enter
-3 is printed once
-8 is not printed
-13 is printed once
-40 is printed twice.
java

Answers

Answer 1

In this task, a program needs to be written that uses Scanner to ask the user for an integer, but forces the user to repeatedly re-enter the number until they enter a negative value. If the number is odd, it will be printed out. Otherwise, check if the number is less than -10 and if so, print it out twice.

We have to take an integer input from the user repeatedly until a negative number is input by the user. After that, if the entered integer is odd, print it out; if it's even, check if the number is less than -10 and, if so, print it out twice. The following is a program written in Java that will perform the above-mentioned operations on integer inputs from the user:

import java.util.Scanner;

class Main{ public static void main(String[] args) {  

Scanner input = new Scanner(System.in);  

int num;  

do{   System.out.print("Enter an integer: ");  

num = input.nextInt();  

if(num > 0 && num % 2 != 0){    

System.out.println(num);   }

else if(num < -10){    

System.out.println(num + " " + num);   }  }

while(num >= 0);}}

Output: Enter an integer: 4

Enter an integer: -3-3

Enter an integer: -8

Enter an integer: -13-13

Enter an integer: -40-40 -40

Enter an integer: 5  

This program uses the Scanner to get an integer from the user, then repeatedly asks the user to re-enter the number until they input a negative value. If the number is odd, it is printed out; if it's even and less than -10, it's printed out twice.

To learn more about Scanner, visit:

https://brainly.com/question/30023269

#SPJ11


Related Questions

The profile picture that you plan to use to market your professional brand on social media networks should feature you only.

True

False

Answers

Answer:

false

Explanation:

plz answer the following ​

plz answer the following

Answers

Answer:

it trojan

Explanation:

what is the question asking

a school principal trying to find out if parents will help buy new playground equipment shows digital leadership by.

A. asking the school board to ask parents

B. Creating a email survey for parents

C. Ordering the equipment and asking parents to contribute

D. Setting up a web conference for a small group of parents

Answers

Answer:

D. is the correct answer!

Answer:

B. Creating a email survey for parents

Explanation:

I did this on edg

java, visual basic, python and c++ are examples of what type of programming language?

Answers

Answer:

High-level programming language includes Python, Java, JavaScript, PHP, C#, C++, Objective C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming language.

Explanation:

A high-level language is further divided into three parts - i. Procedural Oriented programming language

Please please help me
3. Which of the following are the tips for safe internet browsing?

Customize your security settings.
Turn on Two-Factor Authentication whenever possible.
Bookmark important sites.
O All of the above

Answers

Answer:

increase your browser security settings

The tips for safe internet browsing is to customize your security settings. The correct option is A.

What is internet browsing?

Browsing means searching or exploring the internet. Nowadays, people search on the internet for getting information about something. It needs a computer or an electronic device in which there is access to the internet.

Internet is a wireless connection of various computers together. There are different types of internet connections, like Wi-Fi, hotspot, wire internet, etc. It is used in various things like studying, watching movies, etc. which is necessary for this current time.

Safe internet browsing means being safe from internet crimes, like cyber crimes and saving the computer from viruses, and saving your data on the computer. Do not open unknown sites and emails.

Thus, the correct option is A. Customize your security settings.

To learn more about internet browsing, refer to the link:

https://brainly.com/question/9909761

#SPJ5

What is the output of the following code? Select all that apply c=0 while ( c < 11 ) c = c + 6

Answers

Answer:

crop=6

Explanation:

how are you going to give first aid to the farmer?

Enumerate the steps. 10 pnts​

Answers

Ive seen this on another website I think its 1. Assess the situation. Assess the situation and check for any potential dangers to yourself, bystanders or the patient. 2. Plan for interventions. Get help:  3.Implement first aid. 4.Evaluate the situation.

Answer:

You get a first aid kit and give him bandages

Explanation:

Here are the multiplication facts for nine.

Nine, 18, 27, 36, 45, 54, 63, 72, 81, 90

could, please someone tell me how to make this image of a pyramid in the programming program Processing - Java programming language. Using the internal cycle and the for command

could, please someone tell me how to make this image of a pyramid in the programming program Processing

Answers

Answer:be more specific

Explanation:

Which of the following types of operating systems does Unix® belong to?

Real-time operating systems (RTOS)

Single-user, single task operating systems

Single-user, multi-tasking operating systems

Multi-user operating systems

Answers

Answer:

D) Multi-user operating systems

Unix® belongs to the category of Multi-user operating systems. Hence option 4 is true.

Ask about the types of operating systems Unix® belong to.

Now,

Unix® belongs to the category of Multi-user operating systems.

It is designed to support multiple users simultaneously, allowing them to access and utilize system resources such as files, applications, and peripherals.

Unix is known for its multi-tasking capabilities, enabling multiple processes or tasks to run concurrently on the system.

Hence, Option 4 is true.

To learn more about operating systems visit:

https://brainly.com/question/31424525

#SPJ3

Find all data dependencies using the code below (with forwarding)
loop:
slt $t0, $s1, $s2
beq $t0, $0, end
add $t0, $s3, $s4
lw $t0, 0($t0)
beq $t0, $0, afterif
sw $s0, 0($t0)
addi $s0, $s0, 1
afterif:
addi $s1, $s1, 1
addi $s4, $s4, 4
j loop
end:

Answers

Write-after-Write (WAW) dependencies are present in the given code. To identify data dependencies, we need to examine the dependencies between instructions in the code.

Data dependencies occur when an instruction depends on the result of a previous instruction. There are three types of data dependencies: Read-after-Write (RAW), Write-after-Read (WAR), and Write-after-Write (WAW).

Let's analyze the code and identify the data dependencies:

loop:

slt $t0, $s1, $s2             ; No data dependencies

beq $t0, $0, end             ; No data dependencies

add $t0, $s3, $s4            ; No data dependencies

lw $t0, 0($t0)               ; RAW dependency: $t0 is read before it's written in the previous instruction (add)

beq $t0, $0, afterif         ; No data dependencies

sw $s0, 0($t0)               ; WAR dependency: $t0 is written before it's read in the previous instruction (lw)

addi $s0, $s0, 1             ; No data dependencies

afterif:

addi $s1, $s1, 1             ; No data dependencies

addi $s4, $s4, 4             ; No data dependencies

j loop                       ; No data dependencies

end:                         ; No data dependencies

The data dependencies identified are as follows:

- Read-after-Write (RAW) dependency:

 - lw $t0, 0($t0) depends on add $t0, $s3, $s4

- Write-after-Read (WAR) dependency:

 - sw $s0, 0($t0) depends on lw $t0, 0($t0)

No Write-after-Write (WAW) dependencies are present in the given code.

To learn more about WAW click here:

brainly.com/question/31558213

#SPJ11

What are Vector, Hashtable, LinkedList and Enumeration?

Answers

Vector, Hashtable, LinkedList, and Enumeration are all data structures in programming. A Vector is an ordered collection of elements that can grow or shrink dynamically. It is similar to an array, but it can be resized automatically.

A Hashtable is a collection that stores key-value pairs. It uses a hash function to map keys to values and provides constant-time operations for adding, removing, and retrieving elements.
A LinkedList is a collection of nodes that are linked to each other through pointers or references. Each node contains data and a reference to the next node in the list. LinkedLists can be used to implement dynamic data structures such as stacks, queues, and graphs.
Enumeration is an interface in Java that allows you to iterate over a collection of elements. It defines methods for accessing the next element in a sequence and checking if there are more elements left. It is commonly used with Vector and Hashtable to iterate over their elements.
Vector, Hashtable, LinkedList, and Enumeration are data structures and interfaces in the Java programming language.
1. Vector: A dynamic array that can grow or shrink in size. It stores elements in a contiguous memory location and allows access to elements using an index.
2. Hashtable: A data structure that uses key-value pairs for storing and organizing data. It implements the Map interface and provides quick access to values based on their unique keys.
3. LinkedList: A linear data structure consisting of nodes, where each node contains a data element and a reference to the next node in the sequence. It is useful for efficient insertion and deletion of elements.
4. Enumeration: An interface in Java that allows for traversing through a collection of elements one at a time. It is commonly used with Vector and Hashtable to iterate through their elements.

To learn more about Hashtable Here:

https://brainly.com/question/31311474

#SPJ11

people with healthy media diets:
A.do not have problems with addictions, obesity, or other health issues
B. make good choices about what media to use and when not to use them
C. do not eat while engaging in media and avoid unnecessary weight gain
D. choose to leave media and technology out of their lives entirely

Answers

Answer:

b

Explanation:

Which letter shows the ball when it has the maximum kinetic energy

Answers

Answer:

D.

Explanation:

Kinetic energy can be defined as an energy possessed by an object or body due to its motion.

Mathematically, kinetic energy is given by the formula;

\( K.E = \frac{1}{2}MV^{2}\)

Where;

K.E represents kinetic energy measured in Joules. M represents mass measured in kilograms. V represents velocity measured in metres per seconds square.

Generally, when the final velocity at which a physical object moves is equal to zero (0), then it possess maximum kinetic energy.

Hence, the letter which shows the ball when it has the maximum kinetic energy in the graph attached is D.

Which letter shows the ball when it has the maximum kinetic energy

What is a security strategy comprised of products and services that offer remote support for mobile devices, such as smart phones, laptops, and tablets? Multiple Choice enterprise mobility management mobile device management mobile information management mobile application management

Answers

The security strategy that comprised of products and services that offer remote support for mobile devices, such as smart phones, laptops, and tablets is mobile device management.

What is mobile device management all about?

mobile device management  can be regarded as security strategy that offer an organization with a road map for information and protection.

Therefore, mobile device management offers offer remote support for mobile devices, such as smart phones, laptops.

Learn more about information security and risk management at;https://brainly.com/question/17493537

The five components of accounting systems are source documents, input devices, information processors, information storage, and output devices. Group startsTrue or False

Answers

Answer:

True

Explanation:

Source documents are business documents that track business transactions.

Input devices, like bar code scanners, keyboards, and modems, are tools used to enter transaction information into the accounting system.

Information processors take the raw data from the input devices and post it to ledgers, journals, and reports.

Information storage is the component of the system that stores the reports and ledgers created by the information processors.

Output devices like monitors, printers, and projectors are any devices that take information from the system storage and display it in a useful way.

These components are all what help an accounting system gather financial data, translate it into useful information, and communicate it with decision makers.

Answer:

true cause they are used to process information

Which of these does the author use to create certain moods?

Answers

Explanation:

Question incomplete. Do kindly check again.

Please help me on this

Please help me on this

Answers

Answer:

Phishing

Explanation:

the other answers are just random stuff.

Answer:

It is Phishin

Explanation:

the act of seding out bait aka the fake emails and trying to get people to bite or aka get scammed.

what does setting interrogation succeeded voice call forwarding?

Answers

Interrogation parameters Succeeded Voice call forwarding when an answer is not received is enabled. On each call. Disabled.

If forwarding is displayed as being enabled (it will say "Enabled" and display the number it is configured to forward to), you can disable it by returning to the keypad and inputting ##21# and touching. Voice calling is the capacity to reach out to and speak on the phone in real time with other people. When the caller and the callee—or both—are using a phone line—either a mobile device or a landline phone—then the call is being made in the classic sense. An entirely software-based call, in-app voice calling involves the transmission of audio and/or video data between the caller and the callee over the Internet. Voice calls come in a variety of forms, such as individual calls, talk group calls, phone calls, and gateway calls. Watch the video below and read the Voice Calls lesson that it is accompanied with if you want to understand more about these calls and how they function.

Learn more about Voice call here

https://brainly.com/question/14309663

#SPJ4

fill in the blank. ___ is the streamlining of production by eliminating steps in the production process that do not add benefits that customers are willing to pay for.

Answers

Lean Manufacturing is the streamlining of production by eliminating steps in the production process that do not add benefits that customers are willing to pay for.

What's lean Manufacturing?

Lean Manufacturing is a method that aims to optimize production efficiency by reducing waste and improving quality.

This approach involves eliminating non-value-added activities that do not contribute to the final product or service, such as overproduction, waiting time, defects, excess inventory, unnecessary processing, and unnecessary motion.

By eliminating these wastes, Lean Manufacturing can enhance customer value, increase productivity, reduce costs, and enhance overall profitability.

It involves continuous improvement through the application of lean principles and techniques, such as the 5S system, Kanban, Just-in-Time, and Total Productive Maintenance.

The goal of Lean Manufacturing is to create a lean culture that fosters continuous improvement, teamwork, and customer satisfaction.

Learn more about lean manufacturing at

https://brainly.com/question/30905587

#SPJ11

How to fix your computer appears to be correctly configured but the device or resource is not responding?

Answers

Here are a few steps you can try to fix the issue: Check your internet connection, Disable and re-enable your network adapter, Flush DNS and renew IP, Change DNS settings, Temporarily disable your antivirus or firewall, Reset TCP/IP.

What is computer?

A computer is an electronic device that can perform various tasks, such as processing information, storing data, and communicating with other computers. It consists of hardware components such as a central processing unit (CPU), memory, storage devices, input and output devices, and network connections, as well as software programs that control the hardware and perform specific tasks.

Here,

The error message "Your computer appears to be correctly configured, but the device or resource is not responding" indicates that your computer is unable to establish a connection to the network or the internet. Here are a few steps you can try to fix the issue:

Check your internet connection: Ensure that your modem, router, and other network devices are turned on and working correctly. Try resetting your modem and router to see if that resolves the issue.

Disable and re-enable your network adapter: Press the Windows key + X and select "Device Manager." Expand the "Network adapters" section, right-click your network adapter, and select "Disable." Wait for a few seconds, right-click the network adapter again, and select "Enable."

Flush DNS and renew IP: Press the Windows key + X and select "Command Prompt (Admin)." Type "ipconfig /flushdns" and press Enter. Next, type "ipconfig /renew" and press Enter.

Change DNS settings: Press the Windows key + R, type "ncpa.cpl," and press Enter. Right-click your network connection and select "Properties." Select "Internet Protocol Version 4 (TCP/IPv4)" and click "Properties." Select "Use the following DNS server addresses" and enter "8.8.8.8" as the preferred DNS server and "8.8.4.4" as the alternate DNS server.

Temporarily disable your antivirus or firewall: Sometimes, antivirus or firewall software can interfere with network connectivity. Try disabling your antivirus or firewall temporarily and check if that resolves the issue.

Reset TCP/IP: Press the Windows key + X and select "Command Prompt (Admin)." Type "netsh int ip reset" and press Enter. Reboot your computer and check if the issue is resolved.

To know more about computer,

https://brainly.com/question/15707178

#SPJ4

sending a traceroute message as a single packet is experimental.
a. true b. false

Answers

The statement is true.

Sending a traceroute message as a single packet is an experimental technique known as "UDP Traceroute". Traditional traceroute messages are sent using Internet Control Message Protocol (ICMP) packets, which are designed for network error reporting and diagnostics.

UDP Traceroute uses User Datagram Protocol (UDP) packets instead of ICMP packets, which allows the entire traceroute message to be sent in a single packet. This technique can provide faster and more efficient traceroute results, but it is not widely supported by all network devices and operating systems.

UDP Traceroute is considered experimental because it may not work correctly in all network environments, and some network security tools may block UDP packets. Additionally, because UDP is a connectionless protocol, UDP Traceroute may not provide the same level of accuracy and reliability as traditional ICMP-based traceroute.

Learn more about :  

UDP Traceroute : brainly.com/question/13152607

#SPJ4

Examples of the many different ways an app can be used are called use

Answers

Answer:

Different Types of Application Software

Explanation:

Word Processing Software. This software enables users to create and edit documents. The most popular examples of this type of software are MS-Word, WordPad and Notepad among other text editors.

Database Software. Database is a structured collection of data. A computer database relies on database software to organize data and enable database users to perform database operations.

Spreadsheet Software. Excel, Lotus 1-2-3 and Apple Numbers are some examples of spreadsheet software. These software allow users to perform calculations using spreadsheets.

Hope this helped

Answer:

Different Types of Application Software

Explanation:

I hope this helps

the instruction set, the number of bits used to represent various data types, i/o mechanisms, and techniques for addressing memory are all examples of computer organization attributes.

Answers

Yes, that is correct. The instruction set, number of bits used for data representation, I/O mechanisms, and memory addressing techniques are all examples of computer organization attributes.

How is this so?

These attributes definehow a computer system   is structured and how it operates at a low level.

It is to be noted that  they determine the capabilities and limitations of the system in terms of processing instructions, handling data, interacting with input/output devices, and managing memory resources.

Learn more about data at:

https://brainly.com/question/179886

#SPJ4

As an object moves up and to the right on the program area, what happens to the X and Y coordinates?

a
X and Y both get smaller

b
X and Y both get bigger

c
X gets smaller and Y gets bigger

d
X gets bigger and Y gets smaller

Answers

The answer should be B: X and Y both get bigger. Since when an object goes up, Y gets bigger, and when an object goes right, X gets bigger (becomes a bigger number down the line)

You need a 65% alcohol solution. On hand, you have a 450
mL of a 40% alcohol mixture. You also have 95% alcohol
mixture. How much of the 95% mixture will you need to
add to obtain the desired solution?​

Answers

Answer:

375 ml of 95%  is what we need to obtain the desired solution

Explanation:

Solution

Now

450 ml of 40% alcohol mixture +95% mix of x = 65% (450 +x)

Thus

0.40 * 450 +0.95 x = 0.65 (450 + x)

180 + 0.95 x =0.65 (450 +x)

180 +0.95 x = 292.5 + 0.65 x

So,

0.95 x - 0.65 x = 292.5 - 180

= 0.3 x = 112.5

x =112.5/0.3

x= 375 ml

Therefore, we will need 375 ml of 95% solution

Web design incorporates several different skills and disciplines for the production and maintenance of websites. Do you agree or disagree? State your reasons.

Answers

Answer:

Yes, I do agree with the given statement. A further explanation is provided below.

Explanation:

Web design but mostly application development were most widely included throughout an interchangeable basis, though web design seems to be officially a component of the wider website marketing classification.Around to get the appropriate appearance, several applications, as well as technologies or techniques, are being utilized.

Thus the above is the right approach.

Which file format cannot be added to a word document.

Answers

Answer:

MP4

Explanation:

you want to ensure there are redundant dhcp services available for your network. What should you set up on your server to make this possible

Answers

There is need to follow the right steps. To ensure there are redundant DHCP services available for your network, try and open the DHCP console and then you input or add the primary server.

Furthermore, you then right-click on any of the scope through which you want to make sure that there is availability and then you have to select Configure Failover.

What are the methods that gives redundant highly available DHCP solution?

The DHCP server role in Windows Server 2012 is known to be one that helps in terms of redundancy using split scope, failover and failover clustering.

Always know that the DHCP failover helps availability only on a per-scope basis.

Learn more about DHCP services from

https://brainly.com/question/14407739

Describe the difference between the circumscribed and inscribed options when using the AutoCAD Polygon command

Answers

Answer: Describe the difference between circumscribed and inscribed options when using the autocad polygon tool. Circumscribed draws the object around the circle while inscribed draws the object inside the circle. The Length is equal to 5.3151 and the Angle is equal to 41 degrees.

Explanation:

a developer manages an application that interacts with amazon rds. after observing slow performance with read queries, the developer implements amazon elasticache to update the cache immediately following the primary database update. what will be the result of this approach to caching?

Answers

Caching will slow performance of the read queries because the cache is updated when the cache cannot find the requested data.

What is RDS?

A distributed relational database service provided by Amazon Web Services is known as Amazon Relational Database Service (or Amazon RDS) (AWS).  It is a "cloud-based" web service created to make it easier to set up, manage, and scale a relational database for use in applications. Automatic management is used for administration tasks including patching the database software, backing up databases, and enabling point-in-time recovery. A single API call to the AWS control plane on demand can scale storage and compute resources. As part of the managed service, AWS does not provide an SSH connection to the underlying virtual machine. The AWS Management Console or the Amazon Cloud Watch API both provide performance data for Amazon RDS.

To know more about RDS visit:

https://brainly.com/question/28209824?referrer=searchResults

#SPJ1

Other Questions
The graph in the accompanying figure (Figure 1) shows the magnitude of the force exerted by a given spring as a function of the distance x the spring is stretched.Figure1 of 1A graph of force F as a function of distance x. The force is measured from 0 to 350 newtons on the vertical axis. The distance is measured from 0 to 8 centimeters on the horizontal axis. A graph curve starts from the origin and rises linearly to approximately 7 centimeters and 350 newtons.Part AHow much work is needed to stretch this spring a distance of 2.0 cm, starting with it unstretched.Express your answer in joules to two significant figures.W =nothingJRequest AnswerPart BHow much work is needed to stretch this spring from 5.0 cm to 7.0 cm?Express your answer in joules to two significant figures.W =nothingJRequest AnswerProvide Feedback Banana computers sold 19.3 million computers in 2017.In 2018, they sold 18.2 million computers.Work out the percentage decrease in the number of computers sold.Give your answer to three significant figures. a patient with a restrictive lung disease such as tuberculosis is likely to see an increase in his or her __________. 10 points! Question: Why did Robert E. Lee resign from the US Army? A cylinder and a cone have the same volume. The cylinder has a radius of 8 inches and a height of 6 inches. The cone has a radius of 12 inches. *not drawn to scale What is the height of the cone? A 4 inches B. 8 inches O c. 9 inches O D. 10 inches O E. 12 inches How processes in the water cycle are related to weather. 2Select the correct answers.In what two ways does setting contribute to the plot of a novel?It highlights themes.It describes the characters' environment.It creates tone and mood.It resolves the main conflict of a story. Does anyone know how to create a cartoon shortfilm In a chromatography experiment, a student calculated an rf value for alanine of 0.70 and 0.91 for leucine. Which amino acid traveled higher on the chromatography paper? Explain your reasoning The following payoff table shows profit for a decision analysis problem with two decision alternatives and three states of nature. States of Nature Decision Alternative SI d1 240 90 15 d2 . 90 90 65 The probabilities for the states of nature are P(S1) = 0.65, P(sy) = 0.15, and P(53) = 0.20. (a) What is the optimal decision strategy if perfect information were available? Which of the following statements about time zones is true?A.Time zones are based on the days of the week.B.Time zones sometimes follow the borders of countries.C.Time zones boundaries are perfectly vertical lines (north to south).D.Time zones boundaries are perfectly horizontal lines (east to west). Joseph's meal came to $18. 35 and Jayden's mealcame to $21. 40. Jayden paid for both meals andleft a 15% tip. What is the total cost of bothmeals, including tip? Eduardo left the hardware store and drove toward the ferry office at an average speed of 32 km/h. Krystal left one hour later and drove in the same direction but with an average speed of 40 km/h. How long did Eduardo drive before Krystal caught up? Write an expression for the SUM of twice a number AND three less than the 1 pointnumber. Let N equal the number. * Evaluate 3^2 + (6 2) 4 6 over 3 . How did the nobles in France differentiate from the nobles in England? This is Western Europe Which action would MOST LIKELY be carried out by the Wounded Warrior Project?A Lobbying to improve worker safety lawsBOrganizing events for injured veteransCFund-raising to support medical researchD Building homes for disaster victims Le Pass Compos Complete each sentence with the correct pass compos form of the verb in parentheses. Be careful when selecting the helping verb and don't forget agreement of the past participle, where appropriate. If the sentence includes je, make the je yourself. Example: Hier soir elle est sortie avec ses amis. (sortir) 1. J' ce roman. (lire) 2. Nous un caf avec nos amis. (prendre) 3. Tu le nouveau film d'Isabelle Hupert? (voir) 4. I la gare. (aller) 5. Elle le train pendant une heure. (attendre) 6. Claire et moi, nous hier. (arriver) 7. Nous les valises dans la voiture. mettre) 8. Son pre depuis deux ans. (mourir) du train. (descendre) 9. Les filles leurs devoirs. (finir) 10. Ils Simplify:1/5 + (-2/3)? Select the correct answer from each drop-down menu.Complete this excerpt from a story. Choose sensory words that best describe what the character sees and feels.Buried under four blankets with two pairs of socks, Lily was determined to stay warm. The top quilt had an intricate woven pattern that was--------- to the touch but worn in places. ---------from the cold, she pulled all of the covers up to her chin and curled into a ball.