Explanation

515.Read Inputs of Several Data Types

Easy
Given a student's name (string), age (int), grade (a single character), isEnrolled (boolean) and marks (an int array), return five lines describing them: the name, the age, the grade, "yes" or "no" for enrolment, and the total of all marks. Real programs read many kinds of input in one go, and each kind is read and stored differently: primitive typesPrimitive TypesBasic built-in value types such as int, double, char and boolean, as opposed to strings and arrays. like int and boolean, single characters, whole strings, and collections like arrays. In Java you would call nextInt(), next().charAt(0), nextBoolean() and nextLine() on a Scanner; in C, scanf with %d, %c and %s; in Python everything comes from input() and is converted with int(), float() or a comparison. A decimal value would be read the same way with nextDouble() or %lf. Here the values arrive already typed as parameters, so the focus is on using each type correctly — taking a char out of a string, turning a boolean into words, and walking an array.

Example 1:

Input: name = "Asha", age = 19, grade = "A", isEnrolled = true, marks = [80,75,90]

Output: ["Name: Asha","Age: 19","Grade: A","Enrolled: yes","Total marks: 245"]

Example 2:

Input: name = "Dev", age = 22, grade = "C", isEnrolled = false, marks = [40]

Output: ["Name: Dev","Age: 22","Grade: C","Enrolled: no","Total marks: 40"]

+ 3 hidden test cases run on Submit.

Constraints:

  • ●1 ≤ name.length ≤ 30
  • ●1 ≤ age ≤ 120
  • ●grade is exactly one character
  • ●1 ≤ marks.length ≤ 10
  • ●0 ≤ marks[i] ≤ 100

name =

Asha

age =

19

grade =

A

isEnrolled =

true

marks =

[80, 75, 90]