Ask Programming Language Expert

Program 1
Assume a newspaper wants to display the sales in each quadrant of town. 
The quadrant, number of customers, and sales are: 
In the Northwest quadrant, 23 customers with sales of $ 345.00 
In the Northeast quadrant, 156 customers with sales of $ 2111.11 
In the Southwest quadrant, 9 customers with sales of $ 120.80 
In the Southeast quadrant, 222 customers with sales of $3030.35 

Requirements : 
Newspaper: Daily Herald 
Month: June 2014 

#===================================# 
Town Number of Month's 
Quadrant Customers Sales 
#===================================# 
Northwest 23 345.00 
Northeast 156 2111.11 
Southwest 9 120.80 
Southeast 222 3030.35 
#===================================#
prepare a program, using output manipulators, to produce the following output exactly: 
Output Notes: 
• The Newspaper and Month values are aligned on the right. 
• The 'T' of the "Town" column label appears in column 6 of console screen 
(i.e. there are 5 spaces before the word "Town"). 
• The Number of Customers and Month's Sales values are rounded to 2 decimal places 
and are aligned on the right. 

Do not convert the Number of Customers and Sales values in the code to strings (e.g. "23" or 
"345.00"). They should both be coded in the output statements as numbers (e.g. 23 and 345.00). 

Minimally, you must use the setfill output manipulator to create and format the dividing lines, and 
you must use the setw and setprecision output manipulators to format the numeric output in the 
table. 

No variables or constants should be used in this program. 


Program #2 

prepare a program that computes a bill for newspaper delivery for a charge period (weekly, monthly, 
annually, etc). 

The charge for the daily newspaper is 52 cents. The charge for a Sunday newspaper is 75 cents. 
Customers may also tip a percentage of the monthly bill. 

Since the number of days in a charge period varies, the program will need to do some calculations. 
Prompt the user for the number of days in the charge period and a tip percentage. Use these figures 
to find out the total bill. 

For every 7 days, charge for 6 daily papers and 1 Sunday paper. Remaining days will be charged at 
the daily rate. (Hint: Use the division operator (/) to determine the number of full weeks/Sundays, 
and use the modulus operator (%) to determine the number of remaining days over the full weeks). 

Requirements: 

The program must: 

• Define an integer constant that holds the number of daily papers in one week. 
• Define two floating point constants that will hold: 
o The cost of a daily newpaper 
o The cost of a Sunday newspaper 
• Define a string constant for the customer's name - use YOUR name 
(e.g., "Samantha Washington") 
• Define two character variables for the quadrant of town being served 
o One will hold a character representing either the north or south side of town 
- Initialize this value to 'S' for south, when you define it 
o One will hold a character representing the east or west side of town 
- Initialize this value to 'W' for west, when you define it 
• Define an integer variable to store the number of days in the charge period 
(read from the user) 
• Define a floating point variable to store the tip rate (read from the user) 
• Define five floating point variables to store parts of the total cost, the subtotal and the total. 
o The cost of all Sunday papers 
o The cost of all daily papers 
o The newspaper subtotal 
o The tip charge 
o The total bill 
• Display a program description, followed a prompts and input statement to read number of 
days in the charge period from the user. 
Sample Input 



• find out the newspaper costs and then the tip. 
• Add all of the above together to determine the total. 
• Add any other variable definitions or calculation statements you think are needed to perform 
the task 
• Display a few blank lines to separate the input from the output. Then use output 
statements to display the results to the console, in the following format: 

NOTES: 
o The dollar figures in the totals column should all line up, aligned right, on the 
decimal point. 
o If the customer enters 0% for the tip, the tip displayed will be 0.00. 

Documentation 

1) For each program, be sure to include top of program comments 
(as specified in course Content section 1.8) that include: 

Your name, the course, and the assignment number 

What the Program Does including: 
What is Input 
Processing/Calculations Performed 
What is Output 

Customer: Samantha Washington 
Location: SW quadrant 
Days in Period: 30 
Tip Rate: 4.2% 

Cost for daily papers 13.52 
Cost for Sunday papers 3.00 
--------- 
Newspaper Total 16.52 
Tip for Carrier 0.69 
--------- 
Total Billed to Customer 17.21 
Newspaper Billing Program 

Enter number of days in the charge period: 30 
Enter tip percentage (e.g. 5.5 for 5.5% or 0 for none):

2) Clarifying comments beside constants and variable declarations 

3) Inline clarifying documentation, as needed 

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M986232

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As