Web Development
Write a method, makeEmailAddress, that is passed two String arguments: the first is a username, like “leadbelly” and the second is a domain name, like “blues.com”.
LANGUAGE: Java CHALLENGE: Write a method, makeEmailAddress, that is passed two String arguments: the first is a username, like “leadbelly” and the second is a domain name, like “blues.com”. The method returns an email address formed from joining these with an “@”: “[email protected]”.
Read MoreWrite a method, getEmailDomain, that is passed a String argument that is an email address and returns the domain name part. So if “[email protected]” is passed, the method returns “salzberg.de”.
LANGUAGE: Java CHALLENGE: Write a method, getEmailDomain, that is passed a String argument that is an email address and returns the domain name part. So if “[email protected]” is passed, the method returns “salzberg.de”. Assume that the argument will always be a correctly formatted email address.
Read MoreWrite a method, getEmailUserName, that is passed a String argument that is an email address and returns the user-name part.
LANGUAGE: Java CHALLENGE: Write a method, getEmailUserName, that is passed a String argument that is an email address and returns the user-name part. So if “[email protected]” is passed, the method returns “mozart”. Assume that the argument will always be a correctly formatted email address.
Read MoreWrite a method, makeSubjectLine, that gets a String argument and returns the same String but with “Subject: ” in front of it. So if the argument is “Are you going to the show?” the method returns “Subject: Are you going to the show?”.
LANGUAGE: Java CHALLENGE: Write a method, makeSubjectLine, that gets a String argument and returns the same String but with “Subject: ” in front of it. So if the argument is “Are you going to the show?” the method returns “Subject: Are you going to the show?”.
Read MoreWrite the definition of a function minMax that has five parameters.
LANGUAGE: C++ CHALLENGE: Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters. The function does not return a value. The function can be used as follows:…
Read MoreWrite a statement that declares a prototype for a function divide that takes four arguments and returns no value.
LANGUAGE: C++ CHALLENGE: Write a statement that declares a prototype for a function divide that takes four arguments and returns no value. The first two arguments are of type int. The last two arguments arguments are pointers to int that are set by the function to the quotient and remainder of dividing the first argument…
Read MoreThe speed of sound depends on the material the sound is passing through.
LANGUAGE: C++ CHALLENGE: 4.18:The Speed of Sound The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per second) for air, water and steel: air: 1,100 feet per second water: 4,900 feet per second steel: 16,400 feet per second Write a program that…
Read MoreWrite the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit
LANGUAGE: Java CHALLENGE: Write the definition of a class Counter containing: An instance variable named counter of type int An instance variable named limit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit A method named increment. It does not take…
Read MoreWrite an application that reads the (x,y) coordinates for two points.
LANGUAGE: Java CHALLENGE: Write an application that reads the (x,y) coordinates for two points. Compute the distance between the two points using the following formula: Distance = the square root of the sum of the square of the difference of the x coordinates and the square of the difference of the y coordinates
Read MoreCreating objects of the Currency class requires a name (string), a currency symbol (string) and the number of decimal places (integer) usually associated with the currency (in that order).
LANGUAGE: C++ CHALLENGE: Creating objects of the Currency class requires a name (string), a currency symbol (string) and the number of decimal places (integer) usually associated with the currency (in that order). Define an object named curr, of type Currency corresponding to “US Dollar” with the symbol “$” and 2 decimal places.
Read MoreConsider a class Movie that contains the following information about a movie: * Title * MPAA Rating (e.g. G, PG, PG-13, R) * Number of people who rated this movie as a 1 * Number of people who rated this movie as a 2 * Number of people who rated this movie as a 3 * Number of people who rated this movie as a 4 * Number of people who rated this movie as a 5
LANGUAGE: C++ CHALLENGE: Consider a class Movie that contains the following information about a movie: * Title * MPAA Rating (e.g. G, PG, PG-13, R) * Number of people who rated this movie as a 1 * Number of people who rated this movie as a 2 * Number of people who rated this movie…
Read MoreDefine a class called Odometer that will be used to track fuel and mileage for a vehicle.
LANGUAGE: C++ CHALLENGE: Define a class called Odometer that will be used to track fuel and mileage for a vehicle. Include member variables to track the distance driven (in miles) and the fuel efficiency of the vehicle (in miles per gallon). The class will have a constructor that accepts one parameter and initializes distance to…
Read More