General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 15th, 2011, 08:50 PM
NickLee1983 NickLee1983 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 2 NickLee1983 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m
Reputation Power: 0
Progamming logic help

Ok. I am a student majoring in industrial electronics and my advisor thought that this class called programming logic would be easy and relate to PLCs. well I am sure to a computer programmer or programming major this class is a joke but to me it is testing every nerve I have (and has nothing to do with PLCs) and I am now stumped on one. we started this chapter on making decisions and it is using nested decisions and AND,OR decisions.. here is the problem I am completely stumped on.

"the summerville telephone company charges 10 cents per minute for all calls outside the customers area code that last over 20 minutes. all other calls are 13 cents per minute. design a flowchart or pseudocode for a program that accepts the following data about one phone call: customer area code (3 digits), customer phone number (7 digits), called area code (3 digits), called number (7 digits), and call time in minutes (4 digits). display the calling number, called number, and price for the call."

now I am sure to the people here this is elementary but it is like trying to speak alien for me. the book that we use is "programming logic and design: introductory by joyce farrell, sixth edition". I hope I have provided enough information so I can get some help. thanks in advance!

Reply With Quote
  #2  
Old July 15th, 2011, 10:09 PM
NickLee1983 NickLee1983 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 2 NickLee1983 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 17 m
Reputation Power: 0
i think the code it uses is similar to what arduino uses

Reply With Quote
  #3  
Old July 20th, 2011, 05:08 PM
Bobidybob's Avatar
Bobidybob Bobidybob is offline
Contributing Abuser
Click here for more information
 
Join Date: Apr 2007
Location: Starkville, MS
Posts: 336 Bobidybob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 Days 15 h 51 m 40 sec
Reputation Power: 11
Send a message via AIM to Bobidybob
Quote:
Originally Posted by NickLee1983
"the summerville telephone company charges 10 cents per minute for all calls outside the customers area code that last over 20 minutes. all other calls are 13 cents per minute. design a flowchart or pseudocode for a program that accepts the following data about one phone call: customer area code (3 digits), customer phone number (7 digits), called area code (3 digits), called number (7 digits), and call time in minutes (4 digits). display the calling number, called number, and price for the call."


What you want to do is break the problem down into its parts. Lets start with cost. There are two values they charge:

10 cents and 13 cents.

Now you need to figure out the conditions for each cost. Since you have a "catch all" of 13 cents for all other calls, that means you only need to check if a call qualifies as a 10 cent call. If it doesn't, then it's 13 cents. So what are those conditions? A call is 10 cents if it meets ALL of these criteria:

1) Call is over 20 minutes
2) Call area code is not the customer's area code

This means that it has to do both of these things to cost 10 cents. So just write some pseudocode for both of these terms:

Customer area code = ac
Call area code = cac
Length of Call = time

IF ( (time GREATER THAN 20) AND (ac NOT EQUAL TO cac) )

THEN cost = 10 cents * time

ELSE cost = 13 cents * time


Hopefully that helps. I'm sure you can figure out the rest of the problem.
__________________

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Progamming logic help


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap