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
Nikolay [14]
3 years ago
8

Assume that name and age have been declared suitably for storing names (like "Abdullah", "Alexandra" and "Zoe") and ages respect

ively. Write some code that reads in a name and an age and then prints the message "The age of NAME is AGE." where NAME and AGE are replaced by the values read in for the variables name and age. For example, if your code read in "Rohit" and 70 then it would print out "The age of Rohit is 70", on a line by itself. There should not be a period in the output.
Computers and Technology
1 answer:
shutvik [7]3 years ago
3 0

Answer:

I will write the code in C++ and JAVA                    

Explanation:

<h2>C++ Program:</h2>

#include <iostream>

using namespace std;

int main()

{ std::string NAME;  

// i have used std::string so that the input name can be more than a single character.

std::cout << " enter the name"; // take an input name from user

std::getline(std::cin,NAME);

int AGE;

       cout<<"Enter age";  //takes age from the user as input

       cin>>AGE;

   cout<<"The age of "; std::cout <<NAME; cout<< " is " << AGE; }

/* displays the message for example the name is George and age is 54 so    message displayed will be The age of George is 54 and this will be displayed without a period */

<h2>Explanation:</h2>

The program first prompts the user to enter a name and the asks to input the age of that person. As per the requirement the if the user enter the name George and age 54, the program displays the following line as output:

The age of George is 54

Here  std::string is used so that the input string can be more than one character long.

<h2>JAVA code</h2>

import java.util.*;

public class Main

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

String NAME;

Scanner sc = new Scanner(System.in);

System.out.println("Enter a name:");

NAME= sc.nextLine();

int AGE;

Scanner scanner = new Scanner(System.in);

System.out.println("Enter age:");

AGE = Integer.parseInt(scanner.nextLine());

System.out.print("The age of " + NAME + " is " + AGE); }}

<h2>Explanation:</h2>

This is the JAVA code which will work the same as C++ code. The scanner class is used to read the input from the user. The output of the above JAVA code is as follows:

Enter a name: George

Enter age: 45

The age of George is 45

You might be interested in
What is the python print of (“5”+”7”)?
Firdavs [7]

Answer:

57

Explanation:

Since the 5 and the 7 don't represent integers instead they represent strings so it would come out as 57 hope I helped!

4 0
3 years ago
What dose it need For a device to be considered a kind of computer
const2013 [10]

Answer:

Micro controller or MCU (Microcontroller Unit)

Explanation:

Micro Controller Unit is basically a computer on a chip with all components fabricated onto it. It is the core component of a computer.

A Micro Controller has:

  • Central Processing Unit CPU
  • Random access memory RAM
  • Read-only memory ROM
  • I/O peripherals
  • Timers
  • Serial COM ports

all fabricated on a single chip so that it may be connected via buses for providing the desired functionality.

<h3>I hope it will help you!</h3>
8 0
3 years ago
Read 2 more answers
Which description of the plain text file format is most accurate?
Sedbober [7]

Answer:

uses binary code to store data!

Explanation:

5 0
3 years ago
Find out the names of at least 20 programming languages and their developers.
arlik [135]

Answer:

lala

Explanation:

6 0
2 years ago
Read 2 more answers
Which statement best describes network security
Andreyy89
<span>B.network security means all personal information is kept safe the network is not compromised and only authorized users had access 

Im pretty sure they ment has instead of had</span><span />
3 0
2 years ago
Read 2 more answers
Other questions:
  • Descending selection sort with output during execution
    6·1 answer
  • Text, numbers,graphics, sounds entered into a computer's memory during input operations are referred to as
    11·1 answer
  • Once consumers arrive at ge’s social media sites, ge must _____ them about its value proposition and related benefits.
    13·1 answer
  • Your company received a call from a historical society inquiring about the possibility of networking a two-century-old building
    15·1 answer
  • What is performance? Multiple Choice measures how quickly a system performs a process or transaction a system that is not operat
    9·2 answers
  • Which statement accurately describes DTP programs?
    11·1 answer
  • What type of engineer works on cleaning up oil spills?
    8·2 answers
  • tell us things u did as a kid but don't want to admit to it (best gets brainly 5 stasr and a thank you)
    13·2 answers
  • What is an aspect ratio?
    6·1 answer
  • We can save our data peremently on a
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!