Csc 201-lecture 8

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Csc 201-lecture 8 as PDF for free.

More details

  • Words: 340
  • Pages: 8
CSC 201 Lecture - 8 Team work Session - 2

Arrays and Strings-Problems 1) Write a program to check if a user entered string or number is a Palindrome or not. (Ex: The string ‘dad’ is a palindrome! The number ‘121’ is a palindrome! What about the string ‘MADAM’?) 2) Create an array of program size 10 and store 10 numbers. Write a program to display the numbers of the array in both ascending and descending order.

3) Create a class named 'CashRegisterDemo' for a grocery store. This will calculate the total price of item bought by a customer and print out the number of items and total price as a receipt for the customer. If the customer bought grocery above $100 then he/she gets a 5% discount from the total price. Example output: The customer who bought 120$ worth of items will pay 120 * 0.05 = 114$ (Subtract 6$ from 120).

Conditions: a) Your program should keep asking a customer to enter a price (of type double) of the items he/she bought. b) When customer enters 0 as item price, then the program should stop asking for user input.

Your output should be similar to this.

Date: 01/09/2009 Welcome to ABC supermarket. Please enter name: Pavani Please enter the price of 1st item: 20.0 Please enter the price of 2nd item: 60.0 Please enter the price of 3rd item: 70.0 Please enter the price of 4th item: 0 You bought 3 items and the price is $150 Discount applied: 5% Total price: $142.50. Thank you for shopping! Do you need arrays here?

4)Take an array of size 10, print the maximum and minimum number as your output. 5)Input a string to your program, Ex: “Hello CSC 201,How are you?” and your output should be “Hello*CSC*@)!,How*are*you?”

Programming Assignment - 2 • Car Rental System (Simple reservation Java program).

Announcement • Midterm Examination for CSC 201 to be scheduled on 10/20/09 – Tuesday Timings: 11:00am – 12:50pm • In-class quiz for CSC 185 to be conducted on 10/13/2009 - Tuesday

Related Documents

Csc 201-lecture 8
June 2020 1
Csc
May 2020 19
Csc
October 2019 31
Csc
November 2019 34
Csc Bpo
November 2019 24
Firmenvorstellung Csc
June 2020 9