Write a Java
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
Data Structures and Algorithms in Java
Additional Engineering Textbook Solutions
Java How To Program (Early Objects)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Starting Out with C++: Early Objects
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Modern Database Management
Starting Out With Visual Basic (8th Edition)
- Write a java program to simulate a car insurance We have a problem, which is calculating the insurance price at a unified price for all categories.to solve this problem I want to calculate the insurance price in addition to the factors in the uml. For example, if the individual's age is from 18-25, the insurance rate will increase by 1% over the basic price, as well as the type of car and the gender of the person who wants insurance, for example, if a man also increases 1 % and so are all the factors. If you cannot write the entire program, it is not a problem. Write at least the equations for calculating the insurance or half of the program also You can put random numbers and random prices.arrow_forwardWrite a java program to simulate a car insurance We have a problem, which is calculating the insurance price at a unified price for all categories.to solve this problem I want to calculate the insurance price in addition to the factors in the uml. For example, if the individual's age is from 18-25, the insurance rate will increase by 1% over the basic price, as well as the type of car and the gender of the person who wants insurance, for example, if a man also increases 1 % and so are all the factors. If you cannot write the entire program, it is not a problem. Write at least the equations for calculating the insurance or half of the program also You can put random numbers and random prices.arrow_forwardWrite a Java program that inputs three integer variables (called a, b, and c) that represent the length of the sides of a triangle. Your program should store the type of the triangle in an enumeration variable (called type), and display the value of the variable type. Here are the steps to follow: 1- Defines an enumeration to represent the different triangle types: EQUILATERAL, ISOSCELES, SCALENE, and ERROR. The type ERROR is added in case that the value of any triangle sides is less than or equal to zero. 2- Declare then input the three integer variables a, b, and c using a scanner object called keyboard. 3- Declare the enumeration variable type. 4- Determine the type of the rectangle (i.e. Assign a value to the variable type) 5- Print the value of the variable type. NOTE: If all sides are equal, the rectangle is EQUILATERAL. If only two sides are equal, the rectangle is ISOSCELES, otherwise the rectangle is SCALENE. Note that the type of the rectangle should be ERROR if the length…arrow_forward
- WRITE A JAVA PROGRAM. Telco is a cellular telephone company that offers two types of service: standard and premium. Its rates vary, depending on the type of service. The rates are computed as follows: Calculate the amount due if given a service code (s or S means standard service; a service code of p or P means premium service), and the number of minutes the service was used. For the premium service, the customer may be using the service during the day and the night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night. Input Description: There are service code (s, S, p or P) and usage amount u (u≥0). If the service code is p or P, then the usage has two types; day usage du(du≥0) and night usage nu(nu≥0). Output Description: The format is RMt where t is the amount due in Malaysia currency format as shown in the sample output. Hint: Use the…arrow_forwardWrite a Java program (TicTacToe.java) for playing tic-tac-toe. You may assume that two human players are playing against each other. Your program should display an updated board before every turn, prompt the user to enter the row and column in which to play, and display "X wins!", "O wins!", or "Tie!" at the end of the game. Here is a sample run of a correct program (user input indicated by orange text):Let's play Tic-Tac-Toe! - - -- - -- - -Enter a row and column (1, 2, 3) for player X: 2 2 - - -- X -- - -Enter a row and column (1, 2, 3) for player O: 2 3 - - -- X O- - -Enter a row and column (1, 2, 3) for player X: 1 1 X - -- X O- - -Enter a row and column (1, 2, 3) for player O: 1 3 X - O- X O- - -Enter a row and column (1, 2, 3) for player X: 3 3 X - O- X O- - XX wins!arrow_forwardWrite a Java Program: Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome. Let's consider a word too long if its length is strictly more than 10 characters. All too long words should be replaced with a special abbreviation. This abbreviation is made like this: we write down the first and the last letter of a word and between them, we write the number of letters between the first and the last letters. That number is in decimal system and doesn't contain any leading zeroes. Thus, "localization" will be spelled as "l10n", and "internationalization» will be spelled as "i18n". You are suggested to automatize the process of changing the words with abbreviations by using the Java program that implements the static method capitalization(). At that, all too long words should be replaced by the abbreviation and the words that are not too long should not undergo any changes. Input The first line contains…arrow_forward
- Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 points depending on the user’s choice. The numbered cards are worth their number value to the hand. Here are the details of how to play the game: To start the game, the player is given two randomly chosen cards and told their values. The dealer is then given two cards randomly. The human player should only be told the value of the first card given to the dealer. The other card in the dealer's hand is "hidden" until the end of the game. The player is then asked if they want to draw another card for their hand. While the player wishes to draw another card and neither hand has gone…arrow_forwardWrite a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 points depending on the user’s choice. The numbered cards are worth their number value to the hand. Here are the details of how to play the game: To start the game, the player is given two randomly chosen cards and told their values. The dealer is then given two cards randomly. The human player should only be told the value of the first card given to the dealer. The other card in the dealer's hand is "hidden" until the end of the game. The player is then asked if they want to draw another card for their hand. While the player wishes to draw another card and neither hand has gone…arrow_forwardWrite a java program to calculate the electricity bill for a customer , The program should get the customer's information such as customer name , previous reading and current reading as input .After that program should calculate the amount according to number of units consumed by the customer and print a bill .The sample bill and rate per unit are given below. For example a customer consumes 300 units; First hundred units would be charged at the rate of 15 ,and remaining at 30 respectively as per rate given below. Unit range Rate per unit 1-100 15.0 101-300 30.0 301-500 45.0arrow_forward
- Write a java program to calculate the electricity bill for a customer , The program should get the customer's information such as customer name , previous reading and current reading as input .After that program should calculate the amount according to number of units consumed by the customer and print a bill .The sample bill and rate per unit are given below. For example a customer consumes 300 units; First hundred units would be charged at the rate of 15 ,and remaining at 30 respectively as per rate given below. Unit range Rate per unit 1-100 15.0 101-300 30.0 301-500 45.0arrow_forwardwrite a java programarrow_forwardWrite a program code in Java Write a program to compute the ideal weight for both males and females. According to one study, the ideal weight for a female is 100 pounds plus 5 pounds for each inch in height over 5 feet. For example, the ideal weight for a female who is 5'3" would be 100 + 15 = 115 pounds. For a male the ideal weight is 106 pounds plus 6 pounds for each inch in height over 5 feet. For example, the ideal weight for a male who is 6'2" would be 106 + 14*6 = 190 pounds. Your program should ask the user to enter his/her height in feet and inches (both as integers -- so a person 5'3" would enter the 5 and the 3). It should then compute and print both the ideal weight for a female and the ideal weight for a male. The general outline of your main function would be as follows: Declare your variables (think about what variables you need -- you need to input two pieces of information (what?), then you need some variables for your calculations (see the following steps) Get the…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education