Question

MATLAB script 1) Prompt the user for their first name 2) Prompt the user for their...

MATLAB script

1) Prompt the user for their first name

2) Prompt the user for their last name

3) Prompt the user for their age

Display a sentence that greets the user using their first and last name, and congratulates them for what will be their age on their next birthday.

Example: Hello John Smith. Congratulations on turning 45 on your next birthday!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc
clear all
close all
format long;
first=input('Enter first name: ','s');
last=input('Enter last name: ','s');
age=input('Enter age: ');
fprintf('Hello %s %s. Congratulations on turning %d on your next birthday!\n',first,last,age+1);

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
MATLAB script 1) Prompt the user for their first name 2) Prompt the user for their...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Bash script called hello that uses command line arguments to allow the user to...

    Write a Bash script called hello that uses command line arguments to allow the user to put two strings after the command name, when the script is being executed. These strings should represent a first and last name. The script should then write out a greeting to the user that includes the first and last name. Here is an example of how the script might work (the first line represents what the user types to launch the script): [user@HAL] hello...

  • Design a modular program using pseudo-code which prompts a user for their first name, followed by...

    Design a modular program using pseudo-code which prompts a user for their first name, followed by their last name; then displays a "Hello" salutation which concatenates their first name with their last name. Sample output (user input shown in red): Please enter your first name: John Please enter your last name: Smith Hello, John Smith! Your program must include a main module and one function; this function prompts the user for either their first name or last name, using a...

  • 1) Write a MATLAB script to prompt a user to input two numbers, then assess whether...

    1) Write a MATLAB script to prompt a user to input two numbers, then assess whether the two numbers are equal or not. If the two numbers are equal, display that they are equal in the Command Window. If they are not equal, display that they are not equal in the Command Window. 2) Write a MATLAB script that prompts the user to enter the day of the week using the input function. If the information the user enters is...

  • Write a perl script to accomplish following tasks: 1. Prompt user to enter their name and...

    Write a perl script to accomplish following tasks: 1. Prompt user to enter their name and age, and then calculate and display their age in days. 2. Initialize a 20-element array of numbers and print each element. 3. Get a system host name. 4. Get a web page and save it to a file. 5. List background services (daemons) on your system.

  • IN MATLAB Write a script that will prompt the user for strings and read them in,...

    IN MATLAB Write a script that will prompt the user for strings and read them in, store them in a cell array (in a loop), and then print them out.

  • 1. Create a script ScptCalXX (replace XX with your first or last name that does the...

    1. Create a script ScptCalXX (replace XX with your first or last name that does the following • It asks for your name with the following prompt: Please enter your name: • Then it asks for your city with the following prompt: Please enter the city where you live in: • Then it greets you with your name and city: Hello Syed from Toronto, how much money you want to invest today (-1 to quit)? (in case someone entered Syed...

  • Write a MATLAB script that works like following Program User replies (for instance) Hi Hi What’s...

    Write a MATLAB script that works like following Program User replies (for instance) Hi Hi What’s your name? John Smith What year were you born? 1995 Does that mean you are 20? Yes What’s your favorite team? Blues Good luck to your Blues. Buy. Buy. Have a nice day.

  • 3,4,5,6,7,8 please 1. Enter the code to prompt a user to enter their name into a...

    3,4,5,6,7,8 please 1. Enter the code to prompt a user to enter their name into a script and save to name. imputl name) 2. Enter the code to display their name to the command window using "disp" function. 3. Enter the code to display their name using the "fprintf" function ame 4. What is the main difference between the "disp and "fprintf" commands? on 5. What is the main difference between the "fprintf" and "sprintf" commands? 6. What is a...

  • Class name: "NextSquare" Prompt the user to enter an integer. display your name and the next...

    Class name: "NextSquare" Prompt the user to enter an integer. display your name and the next integer larger than the input integer which is a perfect square. for example, if the input is 7, the output should be (your name plus) 9. I am looking for help with this and need the answer to be in JOptionPane with java language.

  • Task #1 Create a program that: 1. Has a comment in the JavaScript code with your...

    Task #1 Create a program that: 1. Has a comment in the JavaScript code with your name and student number 2. Asks the user for their first name with a pop-up prompt screen. Explorer User Prompt Script Prompt: ок Enter your first name: Cancel Joel 3. Asks the user for their last name with a pop-up prompt screen. Explorer User Prompt X Saript Prompt: ок Enter your last name: Cancel Smith 4. Performs string concatenation to combine their first and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT