Skip to content

ananya39mehta/Implementation-of-Inheritance-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Programming in Java Lab Assignment 6 (Implmentation of Inheritance

Part 1: Implementation of Fixed and Growable Stack using Interface_STK

Interface_stk (Interface)

  • push(int element): Adds an element to the stack.
  • pop(): Removes and returns the top element from the stack.
  • displayStack(): Displays all elements in the stack.
  • overflow(): Checks if the stack is full.
  • underflow(): Checks if the stack is empty.

Fixed_stk (Class)

  • Implements the Interface_stk.
  • Represents a fixed-size stack.
  • Uses an array to store stack elements.
  • Operations: push, pop, displayStack.
  • Checks for stack overflow and underflow conditions.

Growable_stk (Class)

  • Implements the Interface_stk.
  • Represents a growable stack.
  • Uses an ArrayList to store stack elements.
  • Operations: push, pop, displayStack.
  • Does not check for stack overflow, but handles underflow condition.

main (Class)

  • Demonstrates the usage of Fixed_stk and Growable_stk.
  • Creates instances of both types of stacks.
  • Pushes elements into each stack, pops elements, and displays the stacks.

Part 2: Student and Result Calculation

Student_part2 (Class)

  • Represents a student with name, roll number, and marks for two subjects.
  • Provides getters and setters for each field.

Exam (Interface)

  • Percent_cal(): Calculates the percentage based on marks.

Result_part2 (Class)

  • Extends Student_part2 and implements Exam.
  • Calculates the percentage using Percent_cal().
  • Displays the result including percentage, name, roll number, and marks.

main_2 (Class)

  • Demonstrates the usage of Result_part2.
  • Creates an instance of Result_part2, passing student details and marks.
  • Displays the result including the calculated percentage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages