Java.lang is the answer you're looking for
Answer:
#include <iostream>
using namespace std;
int main()
{
const int LENGTH = 9;
char sample1[LENGTH];
char sample2[LENGTH];
cout << "Enter 9 characters to be converted to uppercase: ";
for(int i = 0; i < LENGTH; i++){
cin >> sample1[i];
sample1[i] = toupper(sample1[i]);
cout << sample1[i];
}
cout << endl;
cout << "Enter 9 characters to be converted to lowercase: ";
for(int i = 0; i < LENGTH; i++){
cin >> sample2[i];
sample2[i] = tolower(sample2[i]);
cout << sample2[i] ;
}
return 0;
}
Explanation:
- Declare the variables
- Ask the user for the characters
- Using for loop, convert these characters into uppercase and print them
- Ask the user for the characters
- Using for loop, convert these characters into lowercase and print them
Polymorphism; the concept of one definition, but multiple implementations.
In C#, this is done using the 'abstract' and 'override' keywords.
Example:
abstract class Shape {
public abstract double area();
}
class Square : Shape {
private double size;
public Square(double size = 0) {
this.size = size;
}
public override double area() {
return size * size;
}
}