Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

does this need to be in one file? and also i need this to be solved thank you! Download Page CSIT111: Computer Programming I Name

does this need to be in one file? and also i need this to be solved thank you! image text in transcribed
image text in transcribed
image text in transcribed
Download Page CSIT111: Computer Programming I Name CSIT 111 Lab 4 Task 1 Type casting Write a program that read three integers (use nextInt() method) and prints their average. Make sure the fractional part of the result is not lost. For example, if the three integers are 5, 6, and 8, the average should be 6.333. Hint1: Do not forget to import the package for Scanner class Hint2: Type casting is needed. Task 2- Play with Strings Copy the following program to your Lab4 project. your entire program by correcting the indentions. (Ctrl+A then Ctrl+1) // // Stringplay.java // Play with String objects public class StringPlay public static void main(string[args) String college - new String ("Pace University"); // part (a), fill in your code here int stringLength String changel, change, change, change4/ MacBook Pro s Window Help montclair.ir ro.com Paper 1 Final Draft - Google Docs Rational Reasoning MatHAS Ass 2019 Task-Type Casting Write a program that read the Download Page 1 > Task 2 Play with Strings Copy the following program to your Lab4 project. Format your entire program by correcting the indentions. (Ctrl+A then Ctrl+1) oblece.... ****** 1 StringPlay.java // Play with String objects public class String lay public static void main (String[] args) String college - new String ("Pace University"); // part (a), fill in your code here int stringLength: String changel, change2, change, change4; 1/ part (b), fill in your code here System.out.println (college + " contains th + - characters."): // part (c), fill in your code here 1/ part (d), fill in your code here 1/ part (e), fill in your code here 11 part (f), fill in your code here 1/ part (g), f111 in your code here 17 1111 in your code here to print out each changed string. Complete the program by following the instructions below: (a) declare the variable town as String type and initialize it to "Princeton, NJ, USA". MacBook Pro - Page 2 Complete the program by following the instructions below: (a) declare the variable town as String type and initialize it to "Princeton, NJ, USA". CSIT111: Computer Programming I (b) Invokes the length method of the string class to find the length of the college String object and assigns the result to the stringlength variable. Now run your program and check if the print out information is correct. (c) complete the assignment statement so that change is the substring of college with the 3 characters "Pac". Use subString method. Print changed out. (d) complete the assignment statement so that change is the substring of college with the characters "University". Use subString method. Print change2 out. (c) complete the assignment statement so that change contains the same characters as college but all in upper case. Print changes out. (f) complete the assignment statement so that changed is the same as change except all capital E's are replaced with the asterisk (*) character. (g) complete the assignment statement so that change is the concatenation of variable college and variable fown (besides the concat method, what else can you use?). MacBook Pro

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How can the Internet be helpful in a job search? (Objective 2)

Answered: 1 week ago