Follow the directions for starting C++ and opening the Introductory22.cpp fil. T
ID: 3637787 • Letter: F
Question
Follow the directions for starting C++ and opening the Introductory22.cpp fil. The file is contained in iether the Cpp6Chap07Introductory22 Project folder or the Cpp6Chap07 folder. Completethe program by entering a while clause that processes the loop instructions as long asthe user enters the letter Y in either uppercase or lowercase. Save and then run the program. Test the program usig the following three sets of data: y and 100, Y and 200, and n. The total sales amount should be $300. Run te program again. When you are asked wether you awnt to enter a sales amount, type Nand press Enter. Notice that you were not asked to eter the sales amount. Explain why.Explanation / Answer
public class ObjectArrayTypecast { public static void main(String[] args) { Object[] objects; String[] strings = { "A", "B", "C", "D" }; objects = strings; for (Object o : objects) System.out.println(o); strings = null; strings = (String[]) objects; for (String s : strings) System.out.println(s); } }