abstract questions
abstract questions
QUESTIONS 1
Problem Statement
Rock is developing a real-time multiplayer game where players can communicate with
each other through an in-game messaging system. The game features a messaging
system with an abstract class Message and a subclass Email for sending in-game
emails.
Develop a program to help Rock that solicits user input, capturing information such
as sender and recipient addresses, subject, and body of a message. Subsequently,
the program presents the collected details back to the user.
Input format :
The first line of input consists of a string, representing the sender's email
address.
The second line consists of a string, representing the recipient's email address.
The third line consists of a string, representing the subject of the mail.
The fourth line consists of a string, representing the body of the mail.
Output format :
The output displays the information about the mail in the following format:
"Email Format
From: [sender]
To: [recipient]
Subject: [subject]
Body: [body]
Email sent!"
Code constraints :
The given test cases fall under the following constraints:
QUESTIONS 2
Problem Statement
Wick is developing a real-time strategy game where the players command armies
represented by square matrices. The game requires matrix operations to calculate
army strength and overall battle outcomes.
Write a program to assist Wich that includes an abstract class MatrixOperation with
an abstract method performOperation() and a class MatrixAddition. Calculate the
army strength by adding all the elements in the given matrices. Display the matrix
that represents the army's strength.
Input format :
The first line of input consists of an integer N, representing the number of rows
and columns of a square matrix.
Output format :
The output prints the army strength, which is the addition of the given matrices.
Code constraints :
The given test cases fall under the following constraints:
1 ≤ N ≤ 5