answer.
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
lys-0071 [83]
1 year ago
12

5.16 *zyLab: Hello IDE The goal of this problem is learn how to use Eclipse or IntelliJ. Submit the source code files (.java) be

low. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct. Complete the following: In your chosen IDE, create a new project. You can name the project anything you like, we recommend "M5". Create a new class file, titled HelloIDE (which will create the file HelloIDE.java). Write a main method in this class that prompts a user for their name, and then replies with "Hello, ___!" filling in the blank with the typed in name, trimmed. Otherwise, if the string is empty, or just contains only whitespace, or if no input is given, output "Hello, stranger!". Example input/output for input "Mark":
Computers and Technology
1 answer:
givi [52]1 year ago
8 0

Answer:

import java.util.Scanner;

public class HelloIDE

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter your name: ");

 String name = input.nextLine();

 

 name = name.trim();

 

 if(name.equals(""))

     name = "stranger";

     

 System.out.println("Hello, " + name + "!");

}

}

Explanation:

import the Scanner class to be able to get input from the user

Create an object of the Scanner class called input

Ask the user to enter the name and set it to the name

Trim the name using trim() method, removes the whitespaces from the string

Check the name. If name is equal to "", set the name as stranger. This way if the name is empty, or just contains whitespaces or if name is not given, name will be set as stranger.

Print the name in required format

You might be interested in
Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can
Zepler [3.9K]

Answer:

The program in Python is:

Area = float(input("Area: "))

print("Gallons: "+str(Area/350.0))

Explanation:

The requirement of the program is straightforward and what is required is to divide the inputted area by 350.

Hence, the explanation is as follows:

This line prompts user for Area

Area = float(input("Area: "))

This line calculates and prints the equivalent number of gallons

print("Gallons: "+str(Area/350.0))

4 0
1 year ago
How to code 2.9.5: Four colored triangles {Code HS}
Nitella [24]

Answer: penup()

backward(100)

for i in range(4):

pensize(5)

pendown()

left(60)

color("green")

forward(50)

right(120)

color("blue")

forward(50)

color("red")

right(120)

forward(50)

penup()

left(180)

forward(50)

Explanation:

L

6 0
2 years ago
Write a recursive method called printNumPattern() to output the following number pattern. Given a positive integer as input (Ex:
TiliK225 [7]

Answer:

See Explanation Below

Explanation:

// C++ printNumPattern() recursive method

// Comments are used for explanatory purpose

// Only the recursive is submitted

// Method starts here

void printPattern(int num1, int num2, bool dec)  

{  

// Print num2.  

cout << num2 << " ";  

//Printing to num1

if (dec == false && num1 ==num2)  {

 return;  }

// Printing to 0 or negative.  

if (dec)  

{  

// If num2 is greater than num2

if (num2-num1 > 0)  

 printPattern(num1, num2-num1, true);  

else // recur with false dec  

 printPattern(num1, num2-num1, false);  

}  

else // If dec is false.  

 printPattern(num1, num2+num1, false);  

}  

//End of recursive

7 0
2 years ago
Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program
Art [367]

Answer: This is a python code

def lightyear():

   rate=3*100000000   //speed of light

   seconds=365*24*60*60   //number of seconds in 1 year

   return str((rate*seconds)/1000)+" km"    //distance=speed x time

print(lightyear()) //will print value of light hear in kilometers

OUTPUT :

9460800000000.0 km

Explanation:

In the above code, there is a variable rate, which stores the speed of light, i.e. distance traveled by light in 1 second which is in meters. Another variable is seconds, which store the number of seconds in 1 year, which is no of days in 1 year multiplied by the number of hours in a day multiplied by the number of minutes in an hour multiplied by the number of seconds in a minute. Finally, distance is speed multiplied by time, so distance is printed in kilometers and to convert distance in kilometers it is divided by 1000.

4 0
1 year ago
Which of the following is ideal for long distance communication ?
Vinvika [58]
Microwave transmission is ideal for long distance communication. It is so good that it is used for satellite and space probe communication.
3 0
2 years ago
Other questions:
  • Theresa is a certified teacher. She just had a baby and would like to stay home, but still wants to teach. Which career would be
    11·2 answers
  • A ____ resembles a circle of computers that communicate with each other.
    14·1 answer
  • Write the definition of a function named quadratic that receives three double parameters a, b, c. If the value of a is 0 then th
    12·1 answer
  • In your own words, what is pair-programming? What is the role of the driver? What is the role of the navigator? What are some be
    15·1 answer
  • Static packet filtering firewalls are limited to ________. inspecting packets for which there are good application proxy filteri
    8·1 answer
  • In defining security implemention, what are the roles of the following committees. 1) gateway committee 2) project committee 3)
    8·1 answer
  • Given a sorted array of integer, A, with possible duplicate elements. Implement an efficient (sublinear running time complexity)
    12·1 answer
  • 5.19 LAB: Exact change - functions
    10·2 answers
  • Identify the tips to create a well-designed digital portfolio.
    10·1 answer
  • How does Accenture help companies harness the power of data to achieve optimal business outcomes?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!