Question

In: Computer Science

To get full credit for this assignment you must: (1) answer each question - make sure...

To get full credit for this assignment you must:

(1) answer each question - make sure you answer every part of question

AND

(2) respond to at least 2 of your classmates posts

(NOTE: You should not just agree/ disagree with the post. You need to provide justified explanation

of your agreement/disagreement. Be respectful at all times.

Do NOT revise your post after reading other student posts.)

In your own words, answer all questions (4 points each):

  1. [5pts] Chapter 8 - Write a method that displays the third letter of a string (p. 472 in textbook) that is given to the method (i.e. "Jacob" returns the letter 'c')
  2. [5pts] Chapter 8 - Write a method that modifies a string (p. 488 in textbook) using the stringVar.Remove(start) where the method removes the third letter of a string that is given to the method (i.e. "Jacob" returns "Jaob")
  3. [5pts] Chapter 9 - Write a statement that creates an instance of the Transcript class.
  4. [5pts] Chapter 9 - Suppose that an application declares an array of class objects with the following statement:
    • Employee [ ] employees = new Employee[9];
    • Write a loop that creates 10 instances of the class and assigns them to the elements of the array

Solutions

Expert Solution

P.S : I think there is a problem in the question number 4. as they have asked to assign 10 objects into the array whose length is 9 (given). I have assumed the array size as 10. Please go through the solutions minutely before giving a disilke. Thank you.

1. Write a method that displays the third letter of a string (p. 472 in textbook) that is given to the method (i.e. "Jacob" returns the letter 'c')

public class Main
{
public static char displayThird(String s)
{
char a[]=s.toCharArray();
return(a[2]);
}
   public static void main(String[] args) {
       System.out.println("The third letter is: "+displayThird("Jacob"));
   }
}

2. Write a method that modifies a string (p. 488 in textbook) using the stringVar.Remove(start) where the method removes the third letter of a string that is given to the method (i.e. "Jacob" returns "Jaob")

public class Main
{
public static String remove(String s)
{
return(s.substring(0,2)+s.substring(3));
}
   public static void main(String[] args) {
       System.out.println("The string is: Jacob");
       System.out.println("The string after removing the third letter: "+ remove("Jacob"));
   }
}


3.Write a statement that creates an instance of the Transcript class.

Transcript transcript = new Transcript( );

4.Suppose that an application declares an array of class objects with the following statement:

  • Employee [ ] employees = new Employee[9];
  • Write a loop that creates 10 instances of the class and assigns them to the elements of the array

for ( i = 0 ; i<10 ; i++)

{  

Employee emp = new Employee( );

employees [ i ] = emp;

}


Related Solutions

To get full credit, you must write at least 2 paragraphs for each question- or 4...
To get full credit, you must write at least 2 paragraphs for each question- or 4 paragraphs total. There aren't right or wrong answers here. To get full credit, integrate material that we have talked about in class or that you read for class into your own personal reflections. 1. Do you think that most college students understand what consent looks like/means? 2. Do you believe that pornography negatively impacts women and girls? Why or why not?
You must provide properly labeled graphs to get full credit Suppose there is a permanent increase...
You must provide properly labeled graphs to get full credit Suppose there is a permanent increase in the labor force (L) What will be the impact on the long-run level of real GDP (Y)? What will be the impact on private saving (Sprivate), public saving (Spub), national saving (S) What is the impact on the equilibrium interest rate?
Make sure to show all steps to receive full credit, that is: a) Identify the claim:...
Make sure to show all steps to receive full credit, that is: a) Identify the claim: state the null and alternative hypotheses. b) Determine the test: left-tailed, right-tailed, or two-tailed. c) Graph your bell-shaped curve and label your levels of significance or critical value. d) Find your standardized test statistic ? and label it on your graph. e) Decide whether to reject or fail to reject the null hypothesis. f) Interpret your result. 1) A medical researcher suspects that the...
Please answer the following question (s) in an essay format.  To get credit, your response must be...
Please answer the following question (s) in an essay format.  To get credit, your response must be at least one full page of written work (excluding quotes/references), Times New Roman, 12point font, double-spaced, and cited in the proper APA format. Thinking of the financial issues many people have met due to the Pandemic within the past month or so answer the following question(s) is an essay of one or two well-written paragraphs using complete sentences. Which type of Unemployment Insurance should...
Please answer all 3 parts so I can get full credit for this question A five-year...
Please answer all 3 parts so I can get full credit for this question A five-year annuity of ten $5,900 semiannual payments will begin 9 years from now, with the first payment coming 9.5 years from now. The discount rate is 8 percent compunded monthly. a. What is the value of this annuity five years from now? b. What is the value three years from now? c. What is the current value of the annuity? (Do not round intermediate calculations...
You have three questions to answer for this assignment. Read over the questions and make sure...
You have three questions to answer for this assignment. Read over the questions and make sure to answer all parts. Each answer needs to be a minimum of 250 words. Use supply and demand analysis to explain why the quantity of word processing software exchanged increases from one year to the next. Some people will pay a higher price for brand name goods. For example, some people buy Rolls Royces and Rolex watches to impress others. Does knowingly paying higher...
You must label each answer with the number of question. Each question must have at least...
You must label each answer with the number of question. Each question must have at least three sentence answers. There is no maximum sentence, use as many as you wish to thoroughly answer the question. All answers must be complete sentences using proper grammar and spelling. Sarah paid $50,000 for a franchise that covers the entire United States. She intended to sell individual franchises for the each state. Naturally, investors considering buying a franchise from her asked to see the...
You must label each answer with the number of question. Each question must have at least...
You must label each answer with the number of question. Each question must have at least three sentence answers. There is no maximum sentence, use as many as you wish to thoroughly answer the question. All answers must be complete sentences using proper grammar and spelling. Assume you are opening a furniture store. You have some decisions about how to do the accounting for the business. Which type of inventory system will you use? Explain your reasons. specific, LIFO, FIFO,...
INSTRUCTIONS Choose 1 of the 3 essay.questions below to answer. Make sure to write full sentences...
INSTRUCTIONS Choose 1 of the 3 essay.questions below to answer. Make sure to write full sentences and paragraphs You can use examples to support your answer. Do not answer more than 1 questions! Write both answers in the given answer box below Indicate which question you are answering by mentioning the question number Essay questions (answer 1 questions only) 1. Explan the 4 categories of Boston consulting group matrix, what this model is used for, and how the 4 categories...
To receive full credit for any answer, you must explain your answers and include a logical...
To receive full credit for any answer, you must explain your answers and include a logical and correct application of physics principles and/or definitions in your explanation. If there is a mathmatecal solution or drawing to help understand the problem please include 1.    To compute the pressure difference between two points in a fluid, you must add the pressure differences determined from Bernoulli’s equation and Poiseuille’s law. a) Give an example of an actual situation where Bernoulli’s equation can be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT