String character = "Leia"; String planet = "Alderaan"; if (character.equals("Rey")) { planet = "Hoth"; } else
Q: Look at the following statement: String city = "Asheville";Rewrite this statement so that…
A: Given: Look at the following statement: String city = "Asheville";Rewrite this statement so…
Q: Scanner method --------------- reads characters until it encounters a newline character, then…
A: Scanner method --------------- reads characters until it encounters a newline character, then…
Q: Java Constructor(String) This constructor will take a string of digits(no commas) and turn it into…
A: Actually, the answer has given below:
Q: Complete the class LeetMaker class using String methods. Remember that all the String methods are…
A: PROGRAM: //Defining the class public class LeetMaker { //Defining the main() public static…
Q: A(n) _________ is automatically called when an object is created.
A: Given: A(n) _________ is automatically called when an object is created.
Q: Alternate Character DisplayWrite a method that accepts a String object as an argument and then…
A: Here is Your Code
Q: getHour: Returns the hour in military format. getStandHr: Returns the hour in standard format.…
A: //#include "stdafx"//#include <Time> //header file that contains the Time class file#include…
Q: // TODO validity checking for all other constructor arguments this.name = null; this.lines = null;…
A: The answer is given below.
Q: public Account(String name) - Constructor: create an account with the given name and initial balance…
A: In Java, classes are collections of variables and functions that operate on those variables. The…
Q: Write an application for Cody’s Car Care Shop that shows a user a list of available services: oil…
A: Let us consider Java application for Cody’s Car Care Shop that shows a user a list of available…
Q: 1. class box 2. 3. int width; 4. int height; 5. int length; 6. 7. class main 8. 9. public static…
A:
Q: nethod. ) Method 1: - Takes 1 String parameter - Prints out "Hello" + the String argument ) Method…
A: GIVEN: Create a Java program for the above-given question.
Q: this code is right or not Class car { Int modle; String name; Puplic: Int price; Car(int x, string…
A: here is your answer
Q: Java Programming Travel Tickets Company sells tickets for airlines, tours, and other travel-related…
A: Prompt and read the ticket_number Convert the string ticket_number to the long integer and store it…
Q: Person - id: int - fName : String - LastName: String - phoneNum : String + getld() : int + getfName(…
A: Person.java
Q: symbol: variable circleArea location: class Geometry Geometry.java:114: error: cannot find symbol…
A: Below is the code :-
Q: Write a program that plays a number-guessing game to guess a secret number randomly generated within…
A: // Java program for the above approach import java.util.Scanner; public class GuessingGame { //…
Q: Please Write java application not python please? You giving us wrong answers we dont need python we…
A: import java.util.*; public class Limpopo{ public static void main(String args[]) {…
Q: In the class String, the substring method inserts a String into another String. -True or -False
A: The Answer is in step-2.
Q: Temp Converter Create a program that will allow the user to input a temperature in either °C or °F,…
A: Here I have created a function named celsiusToFahrenheit() that converts temperature to Fahrenheit…
Q: This program assigns values to two variables // and performs mathematical operations with them
A: Errors 1. System.out.println("adding " + x + y); The above statement concatenates the value of x and…
Q: String objects are immutable. This means they, a. cannot be changed b. must be initialized c. None…
A: Explanation: Immutable means which cannot be changed. In Java, string objects are immutable then…
Q: public class Holiday { //declaring variables private String name; private int day; private String…
A: Please find the answer below :
Q: Complete the missing line of code: public class Rectangle { private int width; private int height;…
A: The problem is based on parameterised constructors in C++ language.
Q: Assume the following declaration: truct Student string name; int matricNo; Marks marks;
A: //Program: #include<iostream>#include<string>using namespace std;struct Student{string…
Q: Implement the class Character The role should be “primary” or “secondary” all other values are…
A: Begin Enter name Enter role Enter gender Enter age Enter salary Print using toString() End
Q: Write a method that accepts a string as an argument and checks it for proper capitalization and…
A: //Under btnCheck click event private void btnCheck_Click(object sender, EventArgs e) { //assign…
Q: What will be the output of foll #include void fun1 () { cout<<"c++"< void fun2 () cout<<"Jordan"<<"…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: Java program Write an application for Limpopo's Car Care Shop that shows a user a list of available…
A: As per the requirement program has been developed. Algorithm: Step 1: Write the main() method Step…
Q: Person - id: int - fName : String - LastName: String - phoneNum : String + getId() : int + getfName(…
A: In the given picture class diagram is given, with class name : Person datamembers of class Person :…
Q: PROBLEM STATEMENT: Use string concatenation to append the "dogs" string to the parameter str.…
A: Task :- Write a Java program to implement a method which concatenates the string. Java program :-…
Q: Bookshelf Lili and Bibi has just graduated from highschool. They're now in the same university. As…
A: PROGRAMMING APPROACH: // define header file. // Using Struct to store book detail. // Define…
Q: onsider writing code that starts with the ima nage, resulting in the picture on the right be
A: var image=new Simpleimage("Chapel.png"); print(image);
Q: Create an application that contains an enumeration that represents the days of the week. Display a…
A: Enum has to be created Display the values Input a day Display business hours If you want to perform…
Q: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens. The…
A: The required Java code is: import java.util.Scanner;class TaxCalculator{ static double…
Q: public void setName(String name) { vehicleName = name; } public String toString() { return…
A: In the given program the syntax error will come. here the argument in passed for the class Boat is 2…
Q: java finding Distance Between Points Write method distance used to calculate the distance between…
A: Logic:- input 4 points and pass it a method distance of return type double. Use formula sqrt(…
Q: WorkArea Results #include using namespace std; class Player { public: void setName (string a)…
A: Here we have a class callled Player having two instance variable name and score. Accessor and…
Q: Name first: String initial : char last : String Name (): void Name (String aFirst, char aninitial,…
A: Three UML diagrams are given. We need to find the equivalent java code for these diagrams.
Q: Programming challenge description: When John was a little kid he didn't have much to do. There was…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: // This program assigns values to two variables // and performs mathematical operations with them…
A: Explanation: In the given code, values are assigned to "3" variables namely "x", "y", and "z". The…
Q: class Food { protected: string name; public: Food (string a) { name = a; } void print () {…
A: Question: A class code is given, rewrite this class as abstract class, so no instance of this class…
Q: Date int month : int int day : int int year : int + Date (): void + Date(int aMonth, int aDay,int…
A: We have given UML class diagram. It has some attributes and methods. We have to convert the UML…
Q: Question Language: JAVA Keep Guessing Write a program that plays a number-guessing game to guess a…
A: Import the required java libraries. In main an object of the Random class has been created as r. In…
Q: this code is right or not * Class car { Int modle; String name; Int price; Puplic: Car(int x, string…
A: false the code is wrong .
Q: Define a struct fruitType to store the following data about a fruit: Fruit name (string), color…
A: The statement to define structure "fruitType" is given below:
Q: SHAPE String name abstract double getArea() override equals and toString encapsulate the fields
A: We need to define the classes Shape,Rectangle,Circle and Square as per the given description.
Step by step
Solved in 2 steps with 1 images
- Treasure Hunter description You are in front of a cave that has treasures. The cave canrepresented in a grid which has rows numbered from 1to , and of the columns numbered from 1 to . For this problem, define (?, )is the tile that is in the -th row and -column.There is a character in each tile, which indicates the type of that tile.Tiles can be floors, walls, or treasures that are sequentially representedwith the characters '.' (period), '#' (hashmark), and '*' (asterisk). You can passfloor and treasure tiles, but can't get past wall tiles.Initially, you are in a tile (??, ). You want to visit all the treasure squares, andtake the treasure. If you visit the treasure chest, then treasurewill be instantly taken, then the tile turns into a floor.In a move, if you are in a tile (?, ), then you can move tosquares immediately above (? 1, ), right (?, + 1), bottom (? + 1, ), and left (?, 1) of thecurrent plot. The tile you visit must not be off the grid, and must not be awall patch.Determine…var adventurersName = ["George", " Tim", " Sarah", " Mike", " Edward"];var adventurersKilled = 3;var survivors;var leader = "Captain Thomas King";var numberOfAdventurers = adventurersName.length; survivors = numberOfAdventurers - adventurersKilled; console.log("Welcome to The God Among Us\n");console.log("A group of adventurers began their search for the mystical god said to live among us. In charge of the squad was " + leader + " who was famous for his past exploits. Along the way, the group of comrades were attacked by the god's loyal followers. The adventurers fought with bravado and strength under the tutelage of "+ leader + " the followers were defeated but they still suffered great losses. After a headcount of the remaining squad, "+ adventurersKilled +" were found to be dead which left only " + survivors + " remaining survivors.\n"); console.log("Current Statistics :\n");console.log("Total Adventurers = " + numberOfAdventurers);console.log("Total Killed = " +…int grades[100]; int i; for (i=0;i <= 100;i++) { grades[i) = 100; } The above C++ code is the proper way to initialize the grades array, TRUE or FLASE True FalseRest of code in image / This is a bad programming style since it is using goto. // This is an spagetti code and not working.// Use function to display menu, and display game rules,// Use different color for text display.// fix it so it works any way you like./*HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE); // Write 16 lines in 16 different colors. for (int color = 0; color < 16; color++) { SetConsoleTextAttribute (screen, color); cout << " Hello World!" << endl; Sleep(400); // Pause between lines to watch them appear } // Restore the normal text color) SetConsoleTextAttribute(screen, 7);*/#include <iostream>#include <windows.h>using namespace std;int main(){ //textbackground(WHITE); //textcolor(RED); system("cls"); char ch, a[20], ch2; int num = 100, rnum, guess, count, ch1, c = 0; cout << "**********************************************************"<<endl; cout << "*…Student Name: 8) Consider the following ciass definitions. public class LibraryID{ private String name; // Person's name private int ID; // Person's library ID # private ArrayList Books; // Loaned books public LibraryID (String n, int num) { name = n; ID = num; Books = new ArrayList(); } public int getID () { return ID; } public String getName() { return name; } /* CheckOut () and ReturnBook () methods not shown */ Complete the following override method, contained in the LibraryID class. Two LibraryID's are considered the same if their ID numbers are the same. public boolean equals (Object other) { if (other == null){ return false;} LibraryID o = (LibraryID) other; 9) Assuming the code written in 8 is correct, write the call to compare LibraryID one and two inside the if statement. LibraryID one = new LibraryID("Mankind", 106); LibraryID two = new LibraryID ("Mick Foley", 106); if System.out.println("ID's belong to the same person"); else System.out.println("ID's belong to the…#include <stdio.h>#include<stdlib.h>struct Distance{int feet;float inch;} dist1, dist2, sum;int main(){struct Distance* distance1 = NULL; struct Distance* distance2 = NULL; struct Distance* distance3 = NULL; distance1 = (struct Distance*)malloc(sizeof(struct Distance*));distance2 = (struct Distance*)malloc(sizeof(struct Distance*));distance3 = (struct Distance*)malloc(sizeof(struct Distance*));printf("input feet for distance no.1:");scanf("%d", &distance1->feet); printf("input inch for distance no.1:");scanf("%f", &distance1->inch); printf("input feet for distance no.2:");scanf("%d", &distance2->feet); printf("input inch for distance no.2:");scanf("%f", &distance2->inch); printf("input feet for distance no.3:");scanf("%d", &distance3->feet); printf("input inch for distance no.3:");scanf("%f", &distance3->inch); printf("1st distance\n");printf("Enter feet: ");scanf("%d", &dist1.feet); printf("Enter inch: ");scanf("%f",…Term by CodeChum Admin (JAVA CODE) Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is 'x'. There should be two operations for the Term: public Term times(Term t) - multiplies the term with another term and returns the result public String toString() - prints the coefficient followed by "x^" and appended by the exponent. But with the following additional rules: if the coefficient is 1, then it is not printed. if the exponent is 1, then it is not printed ( the caret is not printed as well) if the exponent is 0, then only the coefficient is printed. Input The first line contains the coefficient and the exponent of the first term. The second line contains the coefficient and the exponent of the second term. 1·1 4·3 Output Display the resulting product for each of the test case. 4x^4snack.h #include <string>#include <iostream>#include <vector>class Snack{public:Snack(std::string, float, bool);int set_price(float);void set_expired(bool);void set_name(std::string);std::string name() const{return name_;}float price() const{return price_;}bool expired() const{return expr_;}int how_many_for_ten();private:std::string name_;float price_;bool expr_;};void SortByPrice(std::vector<Snack>&,bool); main.cpp #include <iostream>using namespace std; #include "snack.h" int main(){ Snack snicker=Snack("Snickers",2.0,false); std::cout<<snicker.name()<<" "<<snicker.price()<<" "<<snicker.expired()<<std::endl; Snack twix=Snack("Twix",3.0,false); std::cout<<twix.name()<<" "<<twix.price()<<" "<<twix.expired()<<std::endl; Snack mars=Snack("Mars",1.5,false); std::cout<<mars.name()<<" "<<mars.price()<<" "<<mars.expired()<<std::endl;…Given a map pre-filled with student names as keys and grades as values, complete main() by reading in the name of a student, outputting their original grade, and then reading in and outputting their new grade. Ex: If the input is: Quincy Wraight 73.1 the output is: Quincy Wraight's original grade: 65.4 Quincy Wraight's new grade: 73.1# Coding - Simulate a robot Write a program that simulates the movements of a robot. The robot can have three possible movements: turn right turn left advance The robot is placed on a hypothetical infinite grid, facing a particular direction (north, east, south, or west) at a set of `{x,y}` coordinates,e.g., `{3,8}`, with coordinates increasing to the north and east. Create a Class `Robot` that contains a method `execute` which given a number of instructions will calculate the robot's new position, and the the direction in which it is pointing. ## Example The letter-string "RAALAL" means: Turn right Advance twice Turn left Advance once Turn left yet again Say a robot starts at `{7, 3}` facing north. Running this stream of instructions should leave it at `{9, 4}` facing west. ## Inputs and Outputs The argument of the `execute` is `string` in the format `X Y BEARING COMMANDS`. The method should return a one-liner `string` in the format `X Y BEARING`. In the…In C++ struct myGrades { string class; char grade; }; Declare myGrades as an array that can hold 5 sets of data and then set a class string in each position as follows: “Math” “Computers” “Science” “English” “History” and give each class a letter gradeSEE MORE QUESTIONS