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
Which aspect of business does accounting measure?
VladimirAG [237]

financial aspect

Accounting measurement is the computation of economic or financial activities in terms of money, hours or other units. An accounting measurement is a unit of some measurable element that is used to compare and evaluate accounting data. Accounting is often measured in terms of money.

6 0
3 years ago
All members within a class are by default
miv72 [106K]

Answer:

All the members within a class are by default are private. Private function in a class can access public function within a similar class. Private member formed the implementation of the class and also form the private interface of members within the class.

All the member of class can be access by function inside the class when it is declare as private.

For example:

class test

{     private:

   int a; // when test:a is private

     public:

   test() : a()  // a is accessible in test class  

}

8 0
3 years ago
What is the main difference between a struct and a class?
Kay [80]

Explanation:

A class encapsulates methods, while a struct cannot.

4 0
3 years ago
Your company has decided to hire a full-time video editor. You have been asked to find a system with the level of display qualit
mote1985 [20]

Answer:

"Resolution" and "Refresh rate" is the correct answer.

Explanation:

Resolution:

  • The resolution would be a step for describing the spatial brightness as well as cleanliness of something like a photograph but rather an image. It's always commonly being utilized for the performance evaluation of monitoring devices, digital photographs as well as numerous additional technology components.

Refresh rate:

  • A computer display as well as visualization technology feature that determines the equipment frequency as well as capacity for repainting or re-drawing that this whole presentation upon on-screen for every instant.
4 0
3 years ago
A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
uysha [10]

Answer:

Security Tab is the correct answer.

Explanation:

The Security Tab will enable the users to authorize anyone to use that file or directory.Many clients deleted the security tab because After that nobody can alter the security privileges on the device.

  • With the help of the Security tab, we will minimize the ActiveX attacks on Internet Explorer. This option is available in the Internet Options of the dialog box.
  • Other options are incorrect because they are not related to a given scenario.
8 0
3 years ago
Other questions:
  • Which type of data in es changes least frequently?
    15·1 answer
  • Which term best describes the operating system of a computer
    11·1 answer
  • I need to create a function that returns Pascal's Triangle with n rows, where n is an int argument.
    12·1 answer
  • The most commonly used software in the school systems that include word processor, spreadsheet, database management system, and
    6·1 answer
  • What are three attributes of the input tag
    5·1 answer
  • JAVA
    13·1 answer
  • How many of yall are willing too sub to my channel called "Space Juice" with around 200 subs?!​
    14·1 answer
  • PLEASE HELP ME ASAP I HAVE AN EXAM SOON!!!!
    5·1 answer
  • Before her shift as a cashier at the grocery store, Carla pulls her hair back into a ponytail and makes sure her fingernails are
    15·2 answers
  • What are some real-life situations where multi-dimensional arrays might be useful?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!