I need coding for the following program by tomorrow i.e 30th November.Can anyone please help me out....


3: Stack/Stack Implementation

General Instructions:
Using a stack as your data structure, implement a program that will reverse a line, perform calculations
using prefix notation and check for balance parentheses.
Specific Instructions:
This assignment should be written as a two class Java program. You will develop a class called Stack. The
main program should be in its own class with a main method, and be about 20 lines long.
The main program will do three (3) things:
1. Reverse each line of text in a file
2. Perform calculations on each expression written in a file, separated by a new line.
3. Check for balance parentheses of each line written in a file.
4. Check if a word is a palindrome.

Below is a sample main method for the program:

public static void main(String[] args) throws IOException
{
// Prefix Notation
System.out.println("\n--------Prefix Notation using Stack------------");
Scanner in = new Scanner(new FileReader("prefix.txt"));
while(in.hasNextLine())
{
prefix(in.nextLine());
}
in.close();
// Palindrome
System.out.println("\n--------Palindromes using Stack------------");
FileReader fob = new FileReader("palindrome.txt");
in = new Scanner(fob);
while(in.hasNextLine())
{
String line = in.nextLine();
palindrome(line);
}
in.close();
fob = new FileReader("paren.txt");
in = new Scanner(fob);
// Parenthesis
System.out.println("\n------Balanced Parenthesis check using Stack-----");
while(in.hasNextLine())
{
String line = in.nextLine();
parenthesis(line);
}
in.close();
fob = new FileReader("reverse.txt");
in = new Scanner(fob);
// Parenthesis
System.out.println("\n--------Reverse a string using Stack------------");
while(in.hasNextLine())
{
String line = in.nextLine();
reverse(line);
}
in.close();
}

There's nothing to help you with here. You have to do your own homework. Come back when you have a question.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.