public class array { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.println(" please enter the number "); int n=in.nextInt(); while (n>20 || n
Scanner milan = new Scanner(System.in); System.out.println("Select the size of the array"); int n = milan.nextInt(); System.out.println("Select a number between 1 & 20"); int nr = milan.nextInt(); if(n
public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Write how many numbers you wanna fill the array with:"); int n = sc.nextInt(); if (n 0) { int[] arr = new int[n]; fill(arr); System.out.println("These are the contents"); for (int i = 0; i < arr.length; i++) { System.out.print(arr[i]); } } } static int[] fill (int[] arr) { Scanner sc = new Scanner(System.in); for(int i = 0; i < arr.length; i++) { System.out.println("Write a number:"); int n = sc.nextInt(); arr[i] = n; } return arr; }
Scanner s = new Scanner(System.in); System.out.println("Enter how large you want this array from 1 - 20"); int a = s.nextInt(); while (a < 1 || a > 20) { System.out.println("Please enter an integer between 1-20"); a = s.nextInt(); } int[] array = new int[a]; System.out.println("Enter what integer you want to fill in this array"); Arrays.fill(array, s.nextInt()); System.out.println(Arrays.toString(array));
Sir, I have one doubt. I cannot able to use Point in Online GDB compiler sir. Can you explain me how to resolve that error. It shows that "cannot able to find the symbol point" while compiling the program. What is the Error?
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { //enter number from 1 to 20// fill the array. Scanner input = new Scanner(System.in); System.out.print("how many value do you want to add : "); int add = input.nextInt(); if (add >= 1 && add
describe('Solar Heater Application', function() { let heaterId; let distributerName = "Harvey Spector"; // Updated name to match the image it('Allocate Solar Heater', async function() { // Enter the Distributer Name await element(by.model('distributerName')).sendKeys(distributerName); // Enter the Purchase Date as current date let currentDate = new Date(); let formattedPurchaseDate = currentDate.toISOString().slice(0, 10); await element(by.model('purchaseDate')).sendKeys(formattedPurchaseDate); // Enter the Install Date as the 6th day from the Purchase Date let installDate = new Date(); installDate.setDate(currentDate.getDate() + 6); let formattedInstallDate = installDate.toISOString().slice(0, 10); await element(by.model('installDate')).sendKeys(formattedInstallDate); // Enter the Customer ID as 1002 await element(by.model('customerId')).sendKeys('1002'); // Check if the Register button is interactable let registerButton = element(by.cssContainingText('button', 'Register')); expect(registerButton.isEnabled()).toBe(true); // Click on the Register button await registerButton.click(); // Extract the message that appears after the button is clicked let successMessage = element(by.css('.xt-success')); expect(successMessage.isDisplayed()).toBe(true); // Place an assertion to validate if the "class" attribute at the message is "xt-success" expect(successMessage.getAttribute('class')).toContain('xt-success'); // Extract the solar heater number from the message and store it in the variable heaterId let messageText = await successMessage.getText(); heaterId = messageText.match(/Solar Heater (\d+)/)[1]; }); it('View Bookings', async function() { // Click on "View Bookings" link await element(by.linkText('View Bookings')).click(); // Locate the dropdown let dropdown = element(by.model('heaterIdDropdown')); // Collect all the options of the dropdown let options = dropdown.all(by.tagName('option')); // Iterate through all the options collected and check if any option's text matches the heaterId let found = false; await options.each(async function(option) { let text = await option.getText(); if (text === heaterId) { found = true; await option.click(); } }); // Add a wait statement for 3 seconds await browser.sleep(3000); // Place an assertion to validate if the displayed distributor name matches the distributorName let displayedDistributorName = element(by.css('.distributor-name')).getText(); expect(displayedDistributorName).toEqual(distributerName); }); });
import java.util.*; class Check { public static class Point { int x; int y; Point(int x, int y) { this.x = x; this.y = y; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter the size of the array(Max: 20): "); int n = sc.nextInt(); while(n 20) { System.out.print("Invalid! Enter again: "); n = sc.nextInt(); } Point[] points = new Point[n]; fillArrayOfPoints(points); printArrayOfPoints(points); } private static void fillArrayOfPoints(Point[] points) { Scanner sc = new Scanner(System.in); for(int i = 0; i < points.length; i++) { System.out.print("Enter x and y for Point " + (i + 1) + ": "); points[i] = new Point(sc.nextInt(), sc.nextInt()); } } private static void printArrayOfPoints(Point[] points) { System.out.print("The points are: "); for(int i = 0; i < points.length; i++) { System.out.println("(" + points[i].x + ", " + points[i].y + ")"); } } }
public class array {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println(" please enter the number ");
int n=in.nextInt();
while (n>20 || n
ty
You are very good at Java. Wish you good luck for your future
Great! Thank you!!!
Sir ur explanation is very useful..
When u will upload pythan clases sir
Scanner milan = new Scanner(System.in);
System.out.println("Select the size of the array");
int n = milan.nextInt();
System.out.println("Select a number between 1 & 20");
int nr = milan.nextInt();
if(n
The first example is great for a beginner to understand.
The second example is too complicated.
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Write how many numbers you wanna fill the array with:");
int n = sc.nextInt();
if (n 0) {
int[] arr = new int[n];
fill(arr);
System.out.println("These are the contents");
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i]);
}
}
}
static int[] fill (int[] arr) {
Scanner sc = new Scanner(System.in);
for(int i = 0; i < arr.length; i++) {
System.out.println("Write a number:");
int n = sc.nextInt();
arr[i] = n;
}
return arr;
}
Scanner s = new Scanner(System.in);
System.out.println("Enter how large you want this array from 1 - 20");
int a = s.nextInt();
while (a < 1 || a > 20) {
System.out.println("Please enter an integer between 1-20");
a = s.nextInt();
}
int[] array = new int[a];
System.out.println("Enter what integer you want to fill in this array");
Arrays.fill(array, s.nextInt());
System.out.println(Arrays.toString(array));
Instead of OR operator can we use AND operator. If so, what happens?
Im using eclipse for java programming. In eclipse the (toString) not working. Can you help me with this ?
Import java.util.Arrays;
You is the best😘🔥
Enn thalivan da nee..
It is showing an error as (point cannot be resolved as a type)...if we try with point[] in eclipse..can u pls help with it
how to create the method class in VS code as shown above by using alt and enter?
why should we print the array using 'Arrays' class? How do I print without using the arrays class?
you have to use the loop method then...Otherwise it will not print the elements of the array instead will print the address of the array
Is it possible to solve this without using methods??
Definitely it's possible
Sir, I have one doubt. I cannot able to use Point in Online GDB compiler sir. Can you explain me how to resolve that error. It shows that "cannot able to find the symbol point" while compiling the program. What is the Error?
You need to import class Point from Package awt
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//enter number from 1 to 20// fill the array.
Scanner input = new Scanner(System.in);
System.out.print("how many value do you want to add : ");
int add = input.nextInt();
if (add >= 1 && add
how abot if they put 25 ? it it goest forever . i think u need to use(break:} after while condition
they can't because if they put greater than 20 ,the program will not execute.
sir please make videos on vlsi design, electronics
Hi, macha kowshik
r u lebanese?
Eh esmo Ali Badran
describe('Solar Heater Application', function() {
let heaterId;
let distributerName = "Harvey Spector"; // Updated name to match the image
it('Allocate Solar Heater', async function() {
// Enter the Distributer Name
await element(by.model('distributerName')).sendKeys(distributerName);
// Enter the Purchase Date as current date
let currentDate = new Date();
let formattedPurchaseDate = currentDate.toISOString().slice(0, 10);
await element(by.model('purchaseDate')).sendKeys(formattedPurchaseDate);
// Enter the Install Date as the 6th day from the Purchase Date
let installDate = new Date();
installDate.setDate(currentDate.getDate() + 6);
let formattedInstallDate = installDate.toISOString().slice(0, 10);
await element(by.model('installDate')).sendKeys(formattedInstallDate);
// Enter the Customer ID as 1002
await element(by.model('customerId')).sendKeys('1002');
// Check if the Register button is interactable
let registerButton = element(by.cssContainingText('button', 'Register'));
expect(registerButton.isEnabled()).toBe(true);
// Click on the Register button
await registerButton.click();
// Extract the message that appears after the button is clicked
let successMessage = element(by.css('.xt-success'));
expect(successMessage.isDisplayed()).toBe(true);
// Place an assertion to validate if the "class" attribute at the message is "xt-success"
expect(successMessage.getAttribute('class')).toContain('xt-success');
// Extract the solar heater number from the message and store it in the variable heaterId
let messageText = await successMessage.getText();
heaterId = messageText.match(/Solar Heater (\d+)/)[1];
});
it('View Bookings', async function() {
// Click on "View Bookings" link
await element(by.linkText('View Bookings')).click();
// Locate the dropdown
let dropdown = element(by.model('heaterIdDropdown'));
// Collect all the options of the dropdown
let options = dropdown.all(by.tagName('option'));
// Iterate through all the options collected and check if any option's text matches the heaterId
let found = false;
await options.each(async function(option) {
let text = await option.getText();
if (text === heaterId) {
found = true;
await option.click();
}
});
// Add a wait statement for 3 seconds
await browser.sleep(3000);
// Place an assertion to validate if the displayed distributor name matches the distributorName
let displayedDistributorName = element(by.css('.distributor-name')).getText();
expect(displayedDistributorName).toEqual(distributerName);
});
});
import java.util.*;
class Check {
public static class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter the size of the array(Max: 20): ");
int n = sc.nextInt();
while(n 20) {
System.out.print("Invalid! Enter again: ");
n = sc.nextInt();
}
Point[] points = new Point[n];
fillArrayOfPoints(points);
printArrayOfPoints(points);
}
private static void fillArrayOfPoints(Point[] points) {
Scanner sc = new Scanner(System.in);
for(int i = 0; i < points.length; i++) {
System.out.print("Enter x and y for Point " + (i + 1) + ": ");
points[i] = new Point(sc.nextInt(), sc.nextInt());
}
}
private static void printArrayOfPoints(Point[] points) {
System.out.print("The points are: ");
for(int i = 0; i < points.length; i++) {
System.out.println("(" + points[i].x + ", " + points[i].y + ")");
}
}
}