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
vazorg [7]
4 years ago
5

Write some code that reads a value representing a name into the variable name then prints the message "Greetings, NAME!!!" on a

line by itself where NAME is replaced the value that was read into name. For example, if your code read in "Hassan" it would print out "Greetings, Hassan!!!" on a line by itself.
Computers and Technology
1 answer:
Anettt [7]4 years ago
3 0

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

Scanner input = new Scanner(System.in);

       System.out.print("Please Enter Your name: ");

       String name = input.nextLine();

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

   }

}

Explanation:

In java programming language;

  1. Import and make an object of the Scanner class. This will allow you receive user input
  2. Prompt User to enter a name
  3. receive and store the name in a variable
  4. Using String concatenation (This is achieved with the + operator) output the Greetings as required by the question

You might be interested in
The Monte Carlo method is commonly used to approximate areas or volumes of shapes. In this problem, we will use Monte Carlo to f
sdas [7]

Answer:

import numpy as np

import matplotlib.pyplot as plt

def calculate_pi(x,y):

   points_in_circle=0

   for i in range(len(x)):

       if np.sqrt(x[i]**2+y[i]**2)<=1:

           points_in_circle+=1

       pi_value=4*points_in_circle/len(x)

       return pi_value

length=np.power(10,6)

x=np.random.rand(length)

y=np.random.rand(length)

pi=np.zeros(7)

sample_size=np.zeros(7)

for i in range(len(pi)):

   xs=x[:np.power(10,i)]

   ys=y[:np.power(10,i)]

   sample_size[i]=len(xs)

   pi_value=calculate_pi(xs,ys)

   pi[i]=pi_value

 

print("The value of pi at different sample size is")

print(pi)

plt.plot(sample_size,np.abs(pi-np.pi))

plt.xscale('log')

plt.yscale('log')

plt.xlabel('sample size')

plt.ylabel('absolute error')

plt.title('Error Vs Sample Size')

plt.show()

Explanation:

The python program gets the sample size of circles and the areas and returns a plot of one against the other as a line plot. The numpy package is used to mathematically create the circle samples as a series of random numbers while matplotlib's pyplot is used to plot for the visual statistics of the features of the samples.

4 0
3 years ago
Six external parts of a computer system, which are output and which are input devices.
Zigmanuir [339]
1. The keyboard is an example of an input device.
2. A mouse is an example of an input device.
3. Display Monitors are examples of output devices as they display information.4. Audio speakers are examples of output devices.5. Headsets with microphones are an example of both an input and output device as they allow sound to be inputted and receive sound.6. Printer/Printer scanner. A printer would be an example of an output device, however, a printer scanner combination would be both input and output.

3 0
4 years ago
2.4 Code Practice: Question 1
USPshnik [31]

Answer:

num = float(input("Enter a number : "))

ab = abs(num)

sqrt = float(ab ** 0.5)

print(sqrt)

Explanation:

6 0
4 years ago
Which of the given original work is protected by the copyright law
andreyandreev [35.5K]
BMW is my desion u cant copy write alot of things like books movies logos
7 0
4 years ago
Read 2 more answers
Free points ♡
forsale [732]

Answer:

dax and dear god, also my heart hurts

Explanation:

they are great so is he u should listen to him

4 0
4 years ago
Read 2 more answers
Other questions:
  • Which loan type requires you to make loan payments while you’re attending school?
    9·1 answer
  • • Two advertisers A and B
    8·1 answer
  • There are several factors that can substantially affect the consumer search process. Match the factor with an example of how the
    5·1 answer
  • Proper numeric keyboarding technique includes:
    15·1 answer
  • Which describes the hypothesis of an experiment? the variable changed by the experimenter/ the quantity that must remain constan
    9·1 answer
  • jakie krasnale mieszkaja we wroclawiu i opisz kto napisal kronike, prosze nie kopiowac dlugich tekstow najlepiej by bylo opisac
    6·1 answer
  • I.d 9934607467<br> p.a.s.s 54321<br><br> P.L.E.A.S.E J.O.I.N. Z.O.0.M. M.E.E.T.I.N.G
    10·1 answer
  • Where is 5G being used and how fast is it?​
    5·2 answers
  • Where are 'if' and 'else' statements shown when printing a document in a word processor?
    8·1 answer
  • Complete the sentence.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!