Question: i need help with this in java please Problem 1 (Warm Up): Write a Java application that will: Create an array of 1000 int elements.
i need help with this in java please





Problem 1 (Warm Up): Write a Java application that will: Create an array of 1000 int elements. Use Random class to initialize the array elements. Make sure to use random numbers between 0 and 500. Prompt the user for an integer number between 0 (inclusive) and 500 (inclusive). Print the number of times the entered number is repeated in the array. If the entered number does not exist, print a message saying that. Sample Output 1: Please enter a positive number [0:500]: -34 Please re-enter a positive number [0:500]: 1202 Please re-enter a positive number [0:500]: 47 47 is repeated 12 times Sample Output 2: Please enter a positive number [0:500] : 65 The array does not contain 65 Important Note: Save your work in Java file called: TestArray.java Problem 2: You are working at Ferrari and you are asked by your manager to design a class for the vehicles Ferrari produces. A) Based on your experience, you decide to have the following design for the requested class: Class Name: Vehicle Fields: Chassis number (type int): This field is named: chassis_num Production cost (type double): This field is named: prod_cost Model name (type String): This field is name: model_name Production year (type int): This field is named: prod_year Constructors: Full-argument constructor No-argument constructor Copy constructor Getter and setter methods for each of the above fields. Override the toString() method to return the following String message: Ferrari Tributo with chassis number 12345 costs 1.5 Million SAR and is produced in year 2024. Note: This is a sample output for a Vehicle object with the following fields: chassis_num : 12345 prod_cost : 1.5 model_name : Tributo prod_year: 2024 Override the equals() method to compare two vehicles based on their chassis numbers. The method should return true if both vehicles have the same chassis number and false otherwise. B) Write a test or a driver class called: Test_ Vehicle. Create two objects of Vehicle class with the following details: Object 1 chassis_num : 12345 prod_cost : 1.5 model_name : Tributo prod_year: 2024 Object 2 chassis_num : 743823 prod_cost : 1.2 model_name : Lusso prod_year : 2023 Then, create a third object based on the second object using the copy constructor of Vehicle class. Print the content of the 3 objects. Update the production cost of the second object to 2.05. Compare the second and third objects. If both objects are identical, display the following message: We have two Ferrari cars with the same chassis number!! This must be wrong! In case, the objects are different, you should print the following message: We have no duplicate chassis number! Everything is cool! Important Notes: Submit the two Java files (Vehicle.java and Test_Vehicle.java) through LMS. Do NOT submit a zip or rar file. ONLY THE JAVA SOURCE FILES!!! Stick to the class names are specified in this document! DO NOT CHANGE THE CLASSES' NAMES OR METHODS' NAMES Problem 3: You are working at Amazon.sa and you are asked by your manager to design a class for product items sold at Amazon.sa. . A) Based on your experience, you decide to have the following design for the requested class: Class Name: Saleltem Fields: Serial number (type int): This field is named: ser_num Unit price (type double): This field is named: unit_price Product name (type String): This field is name: prod_name Number of available items (type int): This field is named: num_items Constructors: Full-argument constructor No-argument constructor Copy constructor Getter and setter methods for each of the above fields. Override the toString() method to return the following String message: Sale Item with serial number 123 is called Mexican Hat and costs 150.5 SAR. 250 units are available in the store Note: This is a sample output for a Saleltem object with the following fields: ser_num: 123 unit_price : 150.5 prod_name : Mexican Hat num_items : 250 Override the equals() method to compare two product items based on their serial numbers. The method should return true if both product items have the same serial number and false otherwise. B) Write a test or a driver class called: Test_ Saleltem. Create two objects of Saleltem class with the following details: Object 1 ser_num: 123 unit_price : 150.5 prod_name : Mexican Hat num_items: 250 Object 2 ser_num: 156 unit_price: 0.5 prod_name : HB2 Pencil num_items : 1450 Then, create a third object based on the second object using the copy constructor of Saleltem class. Print the content of the 3 objects. Update the unit price of the second object to 1.25. Compare the second and third objects. If both objects are identical, display the following message: We have two identical sale items! Kindly update the system records! In case, the objects are different, you should print the following message: We have different sale items! No need to update the system records! Important Notes: Submit the two Java files (Saleltem.java and Test_Saleltem.java) through LMS. Do NOT submit a zip or rar file. ONLY THE JAVA SOURCE FILES!!! Stick to the class names are specified in this document! DO NOT CHANGE THE CLASSES' NAMES OR METHODS' NAMES
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
