How to write this program ?

Home » Programming & Design » How to write this program ?
Programming & Design 1 Comment

Hi guys..i would like to ask on how to Write a program that will ask the user fot the initials of the user's first and last names and then output a greeting that says "Hello". followed by the user's initials and an exclamation mark. For example, if the user's initials are "J" and

Hi guys..i would like to ask on how to Write a program that will ask the user fot the initials of the user's first and last names and then output a greeting that says "Hello". followed by the user's initials and an exclamation mark. For example, if the user's initials are "J" and "D". then the output greeting would be:
Hello J D!
How to write this program in JAVA?

Other answer:

Sulaiman:
So, the keyword is "HOW."

First: find the API reference for whatever programming language you're using.

Second: look up "read" and "write." You need to write a prompt "What are your initials?" Then you need to read whatever the user "inputs." Usually, the input will be sent to STDIN. That's a keyword.

By now you'll be wondering what variables are. Read about those. Once you've done that, write the contents of what you just read in the format "Hello, [INITIALS]!"

UPDATE: There's a book by O'Reilly on Java that I highly recommend for newcomers: "Headfirst Java." Pick it up and you should get there in no time.

EddieJ:
Hi, Sulaiman,

You didn't specify a programming language.

In Python3 you could start with

first = input ("Enter your first initial: ")

You should always show us YOUR attempt to write the program. You are acting like you've been given an assignment without any examples to go by.

brilliant_moves:
Hi, Sulaiman.
You didn't state which prog. language you're using, so here's how you could code your solution in Python 2:

inits = raw_input ("Enter initials: ")
greet = raw_input ("Enter greeting: ")
print "%s %s!" % (greet, inits)

Sulaiman:
oh sorry in JAVA

One thought on - How to write this program ?

LEAVE A COMMENT