Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THESE PROGRAMS NEED TO BE DONE IN JAVA. Neat with Psudeo code. Program #1: A bookstore has two types of Book Club memberships. A 6

THESE PROGRAMS NEED TO BE DONE IN JAVA. Neat with Psudeo code.

Program #1: A bookstore has two types of Book Club memberships. A 6 month membership that costs $50.50 and a 12 month membership that costs $99.00. Write a program to keep track of the total membership sales (of both types combined). So your program should have a double type variable called totalSales that is updated after each book club membership sale.

Your program should first display the following menu and ask the user for a selection (use do-while):

BOOK CLUB MEMBERSHIP MENU:

1) Sell a Six Month Membership

2) Sell a Twelve Month Membership

3) Quit the Program

Make a selection by choosing a number:

-Store the users selection in a variable named choice of type int.

  • If the user selects choice 1, add $50.50 to the totalSales Then print a message to the screen telling the user they sold one six month membership.
  • If the user selects choice 2, add $99.00 to the totalSales Then print a message to the screen telling the user they sold one twelve month membership.
  • If the user enters a choice that is NOT 1, 2, or 3 print an error message that says You have made an invalid selection.
  • If the user selects choice 3, print the total sales made and then quit the program.

Your output could be something like the example below where the user sold two six month memberships and two twelve month memberships (format the number):

The total book club membership sales were $299.00.

-As long as the user does not enter 3 to Quit the Program, allow the user to sell more memberships. You will need a menu loop to do this (see the lecture).

Program #2: Write a program that opens up the "data.txt" file (get that file from Canvas under examples) and use a while loop that reads the values, prints each value, sum each, and find the highest value. Print the highest and total and close the file.

Note: This program has NOTHING to do with program 1. It is just an exercise of opening and reading a file. Also set the highest number to zero before reading the numbers from a file (assume only positive values).

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions