Week 12 : Programming Assignment 1
Write a program that calculates the letter grade based on a numerical score entered by the user.
§ >=80 - A
§ 70-79 - B
§ 60-69 - C
§ 50-59 - D
§ 40-49 - P
§ <40 - F
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 80 | Grade: A | Grade: A\n
| Passed after ignoring Presentation Error |
Test Case 2 | 40 | Grade: P | Grade: P\n
| Passed after ignoring Presentation Error |
Week 12 : Programming Assignment 2
Write a program that validates a user's password based on the following criteria (in the following order):
§ 1. The password must be at least 8 characters long.
§ 2. The password must contain at least one uppercase letter (A-Z).
§ 3. The password must contain at least one lowercase letter (a-z).
§ 4. The password must contain at least one digit (0-9).
Take the following assumptions regarding the input:
§ The input will not contain any spaces
Your output should print the rule that it violates exactly as defined above.
If the password violates multiple rules then the first rule it violates should take priority.
For example:
Input:
pass
Output:
Your password is invalid.
The password must be at least 8 characters long.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Password123 | Your password is valid. | Your password is valid. | Passed |
Test Case 2 | password123 | Your password is invalid.\n
The password must contain at least one uppercase letter (A-Z). | Your password is invalid.\n
The password must contain at least one uppercase letter (A-Z).\n
| Passed after ignoring Presentation Error |
Week 12 : Programming Assignment 3
Write a program that analyzes a given text and provides the following information:
§ Number of words: The total number of words in the text.
§ Longest word: The longest word found in the text.
§ Vowel count: The total number of vowels (a, e, i, o, u) in the text.
Take the following assumptions regarding the input:
§ The input will only contain lowerspace characters[a-z] and spaces.
§ The last word will not end with a space nor with any special character.
You need to print exactly as shown in the test case.
Do not print anyting else while taking input.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | this is a sample text for analysis | Number of words: 7\n
Longest word: analysis\n
Vowel count: 10 | Number of words: 7\n
Longest word: analysis\n
Vowel count: 10 | Passed |
Test Case 2 | lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua | Number of words: 19\n
Longest word: consectetur\n
Vowel count: 45 | Number of words: 19\n
Longest word: consectetur\n
Vowel count: 45 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
Week 12 : Programming Assignment 4
Write a Java program to calculate the area of different shapes using inheritance.
Each shape should extend the abstact class Shape
Your task is to make the following classes by extending the Shape class:
§ Circle (use Math.PI for area calculation)
§ Rectangle
§ Square
Each Shape subclass should have these private variables apart from the private variables for storing sides or radius.
private String shapeType;
private double area;
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Circle
10.0 | Area of Circle: 314.1592653589793 | Area of Circle: 314.1592653589793 | Passed |
Test Case 2 | Square
10.0 | Area of Square: 100.0 | Area of Square: 100.0 | Passed |
Test Case 3 | Rectangle
10.0 20.0 | Area of Rectangle: 200.0 | Area of Rectangle: 200.0 | Passed |
Week 12 : Programming Assignment 5
Implement two classes, Car and Bike, that implement the Vehicle interface.
Each class should have appropriate attributes and constructors.
Ensure that the start, accelerate, and brake methods are implemented correctly for each vehicle.
Follow the naming convention as given in the main method of the suffix code.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | Car
4 | Car with 4 doors started\n
Accelerating to 60 mph\n
Applying brakes | Car with 4 doors started\n
Accelerating to 60 mph\n
Applying brakes | Passed |
Test Case 2 | Bike
2 | Bike with 2 wheels started\n
Accelerating to 40 mph\n
Applying brakes | Bike with 2 wheels started\n
Accelerating to 40 mph\n
Applying brakes | Passed |
No comments:
Post a Comment
Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.