Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

java-assignment

Objective

This repository contains a series of Java programming assignments designed to strengthen your understanding of fundamental programming concepts, algorithms, and problem-solving techniques. Each assignment focuses on a specific topic, ranging from basic array manipulation to more complex string processing and mathematical calculations.

Table of Contents

  1. Finding the 2nd Highest CGPA
  2. Sorting CGPA Array
  3. Binary Search on CGPA Array
  4. Random Number Array
  5. Break Down Amount into Notes
  6. Pattern Printing
  7. Finding the 2nd Lowest Height
  8. String Analysis
  9. Character Frequency Counter
  10. Finding Unique Numbers
  11. Summing User Input
  12. Cost Calculation with Discount

1. Finding the 2nd Highest CGPA

Objective: Write a program to find the student with the 2nd highest CGPA from a list of CGPAs using a linear search algorithm.

Concepts Used:

  • Arrays
  • Linear search

2. Sorting CGPA Array

Objective: Sort the array of CGPAs in descending order without using built-in sorting methods.

Concepts Used:

  • Arrays
  • Sorting algorithms (e.g., Bubble sort)

3. Binary Search on CGPA Array

Objective: Implement a binary search to find if a given CGPA exists in the array. Assume the array is already sorted.

Concepts Used:

  • Binary search
  • Arrays
  • User input

4. Random Number Array

Objective: Generate an array of 10 random integers, print all numbers, and find the maximum and minimum values.

Concepts Used:

  • Random number generation
  • Arrays
  • Looping

5. Break Down Amount into Notes

Objective: Given an amount of money, break it down into the fewest number of currency notes possible.

Concepts Used:

  • Arrays
  • Greedy algorithm

6. Pattern Printing

Objective: Write a program to print a specific pattern (first decrement 5-1, then increment 1-5).

Concepts Used:

  • Nested loops
  • String manipulation

7. Finding the 2nd Lowest Height

Objective: Write a program to find the 2nd lowest height among 10 babies without using a built-in sort method.

Concepts Used:

  • Arrays
  • Linear search

8. String Analysis

Objective: Analyze a string to count the number of words, characters (excluding spaces), vowels, and consonants.

Concepts Used:

  • String manipulation
  • Looping

9. Character Frequency Counter

Objective: Count the frequency of each character in a string.

Concepts Used:

  • Strings
  • HashMaps (optional for advanced implementation)
  • Looping

10. Finding Unique Numbers

Objective: Find and print the numbers in an array that are not duplicated.

Concepts Used:

  • Arrays
  • Looping
  • Conditional logic

11. Summing User Input

Objective: Continuously take integer input from the user and print the sum until the user inputs q. If a non-integer character is input, ask for input again.

Concepts Used:

  • User input
  • Loops
  • Conditional statements

12. Cost Calculation with Discount

Objective: Calculate the total cost of a laptop and a mouse after a 15% discount is applied.

Concepts Used:

  • Arithmetic operations
  • String parsing

Getting Started

To run these programs:

  • Install Java: Ensure you have JDK installed on your system.
  • Compile and Run: Use the javac command to compile the .java files and java command to run them.
    • javac Assignment.java
    • java Assignment

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages