en
Feedback
ACCENTURE | COGNIZANT | IBM | CAPGEMINI

ACCENTURE | COGNIZANT | IBM | CAPGEMINI

Open in Telegram
7 355
Subscribers
-424 hours
-247 days
-10930 days
Posts Archive
L&Tβœ…βœ…βœ… Contact: @MLCODER2
L&Tβœ…βœ…βœ… Contact: @MLCODER2

IBM CIC βœ…βœ…βœ… Contact: @MLCODER2
IBM CIC βœ…βœ…βœ… Contact: @MLCODER2

case "update car": System.out.print("Enter car model to update: "); String carToUpdate = scanner.nextLine(); if (carInventory.containsKey(carToUpdate)) { System.out.print("Enter new number of doors: "); int newDoors = scanner.nextInt(); scanner.nextLine(); // Consume newline carInventory.get(carToUpdate).update(newDoors); } else { System.out.println("Car not found."); } break; case "update bike": System.out.print("Enter bike model to update: "); String bikeToUpdate = scanner.nextLine(); if (bikeInventory.containsKey(bikeToUpdate)) { System.out.print("Does it have a carrier? (true/false): "); boolean newCarrier = scanner.nextBoolean(); scanner.nextLine(); // Consume newline bikeInventory.get(bikeToUpdate).update(newCarrier); } else { System.out.println("Bike not found."); } break; case "check car": System.out.print("Enter car model to check: "); String carToCheck = scanner.nextLine(); System.out.println(carInventory.containsKey(carToCheck) ? "Car exists in inventory." : "Car not found."); break; case "check bike": System.out.print("Enter bike model to check: "); String bikeToCheck = scanner.nextLine(); System.out.println(bikeInventory.containsKey(bikeToCheck) ? "Bike exists in inventory." : "Bike not found."); break; case "exit": System.out.println("Exiting system..."); scanner.close(); return; default: System.out.println("Invalid command."); } } } } #veihcle_management_system_using_java #L&T

import java.util.*; class Vehicle { protected String make; protected String model; protected int year; public Vehicle(String make, String model, int year) { this.make = make; this.model = model; this.year = year; } public void display() { System.out.print(make + ", " + model + ", " + year); } } class Car extends Vehicle { private int numDoors; public Car(String make, String model, int year, int numDoors) { super(make, model, year); this.numDoors = numDoors; } @Override public void display() { super.display(); System.out.println(", " + numDoors + " doors"); } public void update(int numDoors) { this.numDoors = numDoors; System.out.println("Car updated successfully."); } } class Bike extends Vehicle { private boolean hasCarrier; public Bike(String make, String model, int year, boolean hasCarrier) { super(make, model, year); this.hasCarrier = hasCarrier; } @Override public void display() { super.display(); System.out.println(", " + (hasCarrier ? "Has Carrier" : "No Carrier")); } public void update(boolean hasCarrier) { this.hasCarrier = hasCarrier; System.out.println("Bike updated successfully."); } } public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Map<String, Car> carInventory = new HashMap<>(); Map<String, Bike> bikeInventory = new HashMap<>(); while (true) { String command = scanner.nextLine().toLowerCase(); switch (command) { case "add car": System.out.print("Enter make: "); String carMake = scanner.nextLine(); System.out.print("Enter model: "); String carModel = scanner.nextLine(); System.out.print("Enter year: "); int carYear = scanner.nextInt(); System.out.print("Enter number of doors: "); int numDoors = scanner.nextInt(); scanner.nextLine(); // Consume newline carInventory.put(carModel, new Car(carMake, carModel, carYear, numDoors)); System.out.println("Car added successfully."); break; case "add bike": System.out.print("Enter make: "); String bikeMake = scanner.nextLine(); System.out.print("Enter model: "); String bikeModel = scanner.nextLine(); System.out.print("Enter year: "); int bikeYear = scanner.nextInt(); System.out.print("Does it have a carrier? (true/false): "); boolean hasCarrier = scanner.nextBoolean(); scanner.nextLine(); // Consume newline bikeInventory.put(bikeModel, new Bike(bikeMake, bikeModel, bikeYear, hasCarrier)); System.out.println("Bike added successfully."); break; case "display car": System.out.print("Enter car model: "); String carToDisplay = scanner.nextLine(); if (carInventory.containsKey(carToDisplay)) { carInventory.get(carToDisplay).display(); } else { System.out.println("Car not found."); } break; case "display bike": System.out.print("Enter bike model: "); String bikeToDisplay = scanner.nextLine(); if (bikeInventory.containsKey(bikeToDisplay)) { bikeInventory.get(bikeToDisplay).display(); } else { System.out.println("Bike not found."); } break;

import java.util.PriorityQueue; import java.util.Scanner; class ListNode { int val; ListNode next; ListNode(int val) { this.val = val; this.next = null; } } public class Main { public static ListNode mergeKLists(ListNode[] lists) { PriorityQueue<ListNode> minHeap = new PriorityQueue<>((a, b) -> a.val - b.val); for (ListNode list : lists) { if (list != null) { minHeap.add(list); } } ListNode dummy = new ListNode(-1); ListNode current = dummy; while (!minHeap.isEmpty()) { ListNode smallest = minHeap.poll(); current.next = smallest; current = current.next; if (smallest.next != null) { minHeap.add(smallest.next); } } return dummy.next; } public static ListNode arrayToLinkedList(int[] arr) { if (arr.length == 0) return null; ListNode head = new ListNode(arr[0]); ListNode current = head; for (int i = 1; i < arr.length; i++) { current.next = new ListNode(arr[i]); current = current.next; } return head; } public static void printLinkedList(ListNode head) { ListNode current = head; while (current != null) { System.out.print(current.val + " "); current = current.next; } System.out.println(); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int k = scanner.nextInt(); // Number of linked lists ListNode[] lists = new ListNode[k]; scanner.nextLine(); // Move to next line for (int i = 0; i < k; i++) { String[] elements = scanner.nextLine().split(" "); int[] arr = new int[elements.length]; for (int j = 0; j < elements.length; j++) { arr[j] = Integer.parseInt(elements[j]); } lists[i] = arrayToLinkedList(arr); } ListNode mergedHead = mergeKLists(lists); printLinkedList(mergedHead); scanner.close(); } } #MERGE_K_SORTED_ARRAYS #L&T

Wipro exam βœ…βœ…βœ… Contact: @MLCODER2
+1
Wipro exam βœ…βœ…βœ… Contact: @MLCODER2

WIPRO EXAM βœ…βœ…βœ…
+4
WIPRO EXAM βœ…βœ…βœ…

MTHREE EXAM DONE SUCCESSFULLY βœ…βœ…βœ… Contact: @MLCODER2
+2
MTHREE EXAM DONE SUCCESSFULLY βœ…βœ…βœ… Contact: @MLCODER2

Amazonβœ…βœ…βœ… Contact:@MLCODER2
+1
Amazonβœ…βœ…βœ… Contact:@MLCODER2

WIPRO INTERNATIONAL EXAM βœ…βœ…βœ…βœ… 52 MCQS + 2 CODING βœ…βœ… CONTACT: @MLCODER2
+1
WIPRO INTERNATIONAL EXAM βœ…βœ…βœ…βœ… 52 MCQS + 2 CODING βœ…βœ… CONTACT: @MLCODER2

IBM βœ…βœ…βœ…βœ… Contact: @MLCODER2
IBM βœ…βœ…βœ…βœ… Contact: @MLCODER2

IBM βœ…βœ… CONTACT: @MLCODER2
IBM βœ…βœ… CONTACT: @MLCODER2

Those people who want to clear the IBM CIC exam at 6pm should message me and. Book your slot βœ… 100% clearance βœ… Contact: @MLCODER2

GOT SELECTED FOR INFOSYS βœ… βœ… FOR ANY EXAM OR INTERVIEW HELP πŸ‘‡ CONTACT: @MLCODER2
GOT SELECTED FOR INFOSYS βœ… βœ… FOR ANY EXAM OR INTERVIEW HELP πŸ‘‡ CONTACT: @MLCODER2

GOT SELECTED FOR INFOSYS βœ…βœ… Contact: @MLCODER2
GOT SELECTED FOR INFOSYS βœ…βœ… Contact: @MLCODER2

WIPRO SVAR TEST CLEARED & GOT INTERVIEW MAIL βœ…βœ… contact: @MLCODER2
WIPRO SVAR TEST CLEARED & GOT INTERVIEW MAIL βœ…βœ… contact: @MLCODER2

IBM βœ…βœ…βœ…βœ…
+1
IBM βœ…βœ…βœ…βœ…

Deloitte exam got cleared βœ…βœ… Contact:@MLCODER2
Deloitte exam got cleared βœ…βœ… Contact:@MLCODER2

Amazon Examβœ…βœ…βœ…βœ… Contact: @MLCODER2
+1
Amazon Examβœ…βœ…βœ…βœ… Contact: @MLCODER2