Search

Solution Cart

Remove item Thumbnail image Product Price Quantity Subtotal
× A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Assume that the list will always contain less than 20 word pairs. Hint: here we are going to use oversize array again, so we need a variable to track the number of values in the array. You can use 20 as array capacity. Be careful: Word pairs consist of a name and a phone number (both strings) String[]contactNames=newString[20]; String[]contactNumbers=newString[20]; Important Note: Your output needs to match the required output including the space see Ex: Ex: If the input is: 3 Joe, 123-5432 Linda, 983-4123 Frank,867-5309 Frank the output is: 8675309 Your program must define and call the following method. The return value of getPhoneNumber is the phone number associated with the specific contact name. public static String getPhoneNumber(String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for the string names, and the other for the string phone numbers. Please note that the input has comma. You would need to deal with the comma using indexOf and substring. int comma = userInput.indexOf(","); contactNames[i] = userlnput.substring(0, comma); contactNumbers[i] = userInput.substring(comma + 1); 487182.3555262.qx3zqy7 LAB 20.3.1: LAB 3.3: Contact list 3/10 ACTIVITY LabProgram.java Load default template... import java.util.Scanner; public class LabProgram { /* Define your method here */ public static void main(String[ ] args) { /* Type your code here. */ } } A contact list is a place where you can store a specific contact with other associated information $5.00
$5.00
× 5. Write a program that implements a class called MyTeam. Your class should have the following private data items: Id (int), Name (string), Slogan (string), Wins (int), and Losses (int). You need to define properties with appropriate accessor functions for each of the data items. Methods should include a default constructor that sets values to the empty string or zero, a constructor that allows the user to specify all values for the data items, a member method called DisplayTeamInfo that outputs all the information for the given toy in a reasonable format. Challenge Problem: Code your set accessors to restrict all numeric fields (Id, Wins, Losses) to positive numbers. You can determine how you want to report/respond to the error. (25 pts) The code below is my suggestion for your Main() method for Program 22 static void Main(string[] args) { MyTeam myHitchhikers = new MyTeam(); myHitchhikers.Id = 42; myHitchhikers.Name = "Ford Prefect et. al."; myHitchhikers.Slogan = "Don't panic!"; myHitchhikers.Wins = 525; myHitchhikers.Losses = 42; Console.WriteLine("nTeam 1 Information"); myHitchhikers.DisplayTeamInfo(); MyTeam mykitties = new MyTeam(); Console.WriteLine("nTeall 2 Information"); mykitties.DisplayTeamInfo(); MyTeam myPatriots = new MyTeam(2023, "UC Patriots", "One Big Team", 42, 3); Console.WriteLine("nTeam 3 Information"); myPatriots.DisplayTeamInfo(); //This will test your Challenge Problem Settings if you attempted them Console.WriteLine("nTeam 4 Information"); MyTeam mywinners = new MyTeam(13, "Winners", "We like to win more than you do", -20, -35); } myllinners.DisplayTeamInfo(); 5. Write a program that implements a class called MyTeam. Your class should have the following… $10.00
$10.00

Cart totals

Subtotal $15.00
Total $15.00

Free Worldwide shipping

On all orders above $50

Easy 30 days returns

30 days money back guarantee

International Warranty

Offered in the country of usage

100% Secure Checkout

PayPal / MasterCard / Visa