Saba Hilal

Saba Hilal

54 Articles Published

Articles by Saba Hilal

54 articles

Java program to read a large text file line by line

Saba Hilal
Saba Hilal
Updated on 08-Nov-2024 824 Views

This article includes the way to read text files line by line in Java. Here, the three different methods are explained with examples. Storing a file in text format is important especially when data from one structured /unstructured form is transferred to another form. Therefore, basic file transfer systems integrate the txt file reading and writing process as their application components. Therefore, how to use text file reading and writing methods is also important for making the parsers. Multiple Approaches The given problem statement is solved in three different approaches − By using the BufferedReader ...

Read More

Java Program to Print the Months in Different Formats

Saba Hilal
Saba Hilal
Updated on 11-Sep-2024 913 Views

In this article, we are going to use various approaches for formatting the months using different libraries of Java programming language. There are several ways to display months. Sometimes the months are written as numbers, sometimes the months are written in long form or they are written in short forms. Using java.time.Month In this approach, the months are printed by specifying the month number that starts from the number 1. For instance -> Month.of(1) will give JANUARY. Example In this Java program, we are printing all 12 months name. import java.time.Month; public class ShowMonth { ...

Read More

Java program to print Swastika by taking input from user

Saba Hilal
Saba Hilal
Updated on 27-Aug-2024 2K+ Views

Swastika is a religious symbol of Hinduism, Buddhism, and Jainism. In this article, we will learn to print Swastika by taking user input. Here, are three different approaches for making this design using Java. In all the approaches, the size of the Swastika is decided by the user. The user provides the input for the table or frame size. The Swastika is often used as an example to learn rows, columns, and tabular layout concepts using different languages including Java. Making Swastika using Java. Here, three different approaches are used to make this design using Java − ...

Read More

Java Program to open the Command Prompt and Insert commands

Saba Hilal
Saba Hilal
Updated on 24-Jun-2024 8K+ Views

This article uses various approaches for selecting the commands inserted in the opened command window through the Java code. The command window is opened by using ‘cmd’. Here, the methods of doing the same are specified using Java code. The Command window is first opened using the Java program. It is opened as a child process. If the java program is run in an existing cmd window, another one is opened as a new process. Further, different types of commands are inserted and executed in that opened command window via the java code. These programs may not work in ...

Read More

Python program to input a comma separated string

Saba Hilal
Saba Hilal
Updated on 28-Jul-2023 5K+ Views

When a text string is entered or given as input, it may have commas in between. Sometimes the task is to separate all the comma-separated portions of a sentence or a text string. These portions may have single word or multiple words. These string portions may be further entered as items of list or can be processed further. Similarly, numbers in integer form or decimal form are also needed to be entered while being separated by commas. In such cases, understanding these as numbers is important. By using four different examples, this process of given comma separated string or sentence, ...

Read More

Python program to print all positive numbers in a range

Saba Hilal
Saba Hilal
Updated on 28-Jul-2023 724 Views

Sometimes the task is to select only the positive numbers from a given range. Here, in this Python article, first, the range is taken as input and then the negative as well as positive integers within this range are chosen. In this Python article, from these numbers only the positive numbers are then selected using the different methods in four different examples. In example 1, the positive numbers are picked and separated into another list. In the example 2, all the elements that are not positive are removed. In example 3, the sorted list is split up to zero and ...

Read More

Python program to print all negative numbers in a range

Saba Hilal
Saba Hilal
Updated on 28-Jul-2023 615 Views

Sometimes the task is to select the negative numbers from a given range. Here, in this Python article, first, the range is taken as input and then the integers within this range are specified. From these numbers only the negative numbers are then selected using the different methods in 4 different examples. In example 1, the negative numbers are picked and separated into another list. In the example 2, all the elements that are not negative are removed. In example 3, the sorted list is split upto zero and only negatives are retained. In example 4, filter is used to ...

Read More

How to Make a Time Series Plot with Rolling Average in Python?

Saba Hilal
Saba Hilal
Updated on 28-Jul-2023 1K+ Views

In this article, we will look at two methods for making a Python time series plot with a rolling average. Both strategies make use of well-known libraries like Matplotlib, Pandas, and Seaborn, which offer strong capabilities for data manipulation and visualization. Following these methods will enable you to visualize time series data with a rolling average efficiently and get an understanding of its general behavior. Both methods utilize a similar set of sequential steps, that involve loading the data, turning the date column to a DateTime object, figuring out the rolling average, and producing the plot. The primary distinction is ...

Read More

How to Make a Bell Curve in Python?

Saba Hilal
Saba Hilal
Updated on 14-Jul-2023 2K+ Views

It is a well-known phenomenon that if we take the average of many observations of a random variable, the distribution converges to a normal distribution as the number of observations is increased. For example, if we throw two dice and calculate the sum of the random values that show on these dice each time, it will show a bell-shaped curve as the values that are measured will show the normal tendency. It is also observed that it will not show a perfect bell-shaped curve if it is done only 50 times, and it will show a good bell-shaped curve if ...

Read More

How to make div with left aligned text and right aligned icon using CSS ?

Saba Hilal
Saba Hilal
Updated on 10-Jul-2023 2K+ Views

The tag is used to specify a division. It means a container or a section in an HTML page. Sometimes, inside a div container, text and icons are both needed. And sometimes, the need is to align the text on the left while putting the icon on the right in the same line. The CSS or Cascading Style Sheets means style specifications that are used for formatting an HTML document. It is used to give the style to the web page and its elements. In this HTML-CSS article, using three different examples, the ways to show how to ...

Read More
Showing 1–10 of 54 articles
« Prev 1 2 3 4 5 6 Next »
Advertisements