Jump to content

4 posts in this topic

Recommended Posts

Posted

 

//This program allows the user to search through files from the Social //Security Administraction which contain data on various names. //If found, it then graphs the popularity of each name over time. //Constant values can be used to alter the program's starting year //and the display of the graph itself. import java.util.*; import java.awt.*; import java.io.*; public class BabyNames { public static final int STARTING_DECADE = 1890; //will be initial decade public static final int WIDTH = 60; //width of decade bars on graph public static final int HEIGHT = 30; //height of grey rectangles on graph //This method assigns the return of an indtroductory method to a String and //then passes that string into another method. public static void main(String[] args) throws FileNotFoundException { String name = introName(); conditional(name); } //prints a description of the program, then invites the user to input a name. //Returns the inputted name to main. public static String introName() { System.out.println("This program allows you to search through the"); System.out.println("data from the Social Security Administration"); System.out.println("to see how popular a particular name has been"); System.out.println("since " + STARTING_DECADE + "."); System.out.println(); System.out.print("Name: "); Scanner console = new Scanner(System.in); String name = (console.next()); return name; } //This method evaluates whether or not the inputted name is valid by passing it into //a search method to scan the text files. If the name is valid, this method will call the //graphics methods to construct the graph. If not valid, the method will give a "not found" //reply. The parameter passed is the inputted name. public static void conditional(String name) throws FileNotFoundException { Scanner names = new Scanner(new File("names.txt")); String stats = search(names, name); if (stats.length() > 0) { Scanner meanings = new Scanner(new File("meanings.txt")); String meaning = search(meanings, name); if (meaning.length() > 0) { DrawingPanel graph = new DrawingPanel(780, 560); Graphics g = graph.getGraphics(); graphTemplate(g); graphMeaning(g, meaning); graphDates(g, stats); } } else { System.out.print("\"" + name + "\"" + " not found."); } } //used as a method to search text files for the inputted name. Accepts a Scanner assigned //to a certain .text document, and the user inputted name. public static String search(Scanner namesList, String name) throws FileNotFoundException { while(namesList.hasNextLine()) { String nameLC = name.toLowerCase(); String line = namesList.nextLine(); String lineLC = line.toLowerCase(); if(lineLC.indexOf(nameLC) == 0 && lineLC.charAt(nameLC.length()) == ' ') { System.out.println(line); return line; } } return ""; } //prints the fixed background graphics for the graph. Accepts graphics as parameter. public static void graphTemplate(Graphics g) { g.setColor(Color.LIGHT_GRAY); g.fillRect(0, 0, 780, 0 + HEIGHT); g.fillRect(0, 560 - HEIGHT, 780, 560); g.setColor(Color.BLACK); g.drawLine(0, HEIGHT, 780, HEIGHT); g.drawLine(0, 560 - HEIGHT, 780, 560 - HEIGHT); g.drawRect(0, 0, 779, 559); } //prints the meaning of the name at the header of the graph (top grey rectangle). Accepts //graphics and the string for the meaning of the name as parameters public static void graphMeaning(Graphics g, String meaning) throws FileNotFoundException { g.setColor(Color.BLACK); g.drawString(" " + meaning, 0, 16); } //prints the dates on the graph, their corresponding population values, //and fills in the bars on the graph, the color corresponding to each gender. //Accepts graphics and the string of dates as parameters. public static void graphDates(Graphics g, String stats) throws FileNotFoundException { String gender = stats.substring((stats.indexOf(" ") + 1), (stats.indexOf(" ") + 3)); String dates = stats.substring(stats.indexOf(" ") + 3); Scanner dates2 = new Scanner(dates); int yearCount = 0; while(dates2.hasNextInt()) { int n = dates2.nextInt(); g.setColor(Color.BLACK); g.drawString(" " + (STARTING_DECADE + yearCount * 10), yearCount * WIDTH, 552); if (n == 0) { g.drawString(" " + 0, yearCount * WIDTH, 560 - HEIGHT); } else { g.drawString(" " + n, yearCount * WIDTH, ((n % 2) + (n / 2) + HEIGHT)); g.setColor(Color.PINK); if (gender.charAt(0) == 'm'){ g.setColor(Color.BLUE); } g.fillRect(yearCount * WIDTH, ((n % 2) + (n / 2) + HEIGHT), WIDTH / 2, 560 - ((n % 2) + (n / 2) + HEIGHT) - HEIGHT); } yearCount++; } } }

 

Posted (edited)

what does it do?

It says what it does in the code:

//This program allows the user to search through files from the Social //Security Administraction which contain data on various names. //If found, it then graphs the popularity of each name over time. //Constant values can be used to alter the program's starting year //and the display of the graph itself. 
Updated by Goggwell

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Our picks

    • Soul Huntress: Dungeon Crawler v1.0.3 [+3 Jailed Cheats]
      Modded/Hacked App: Soul Huntress: Dungeon Crawler By Panthera Joint Stock Company
      Bundle ID: com.pantheraplay.soulhuntress
      App Store Link: https://apps.apple.com/ph/app/soul-huntress-dungeon-crawler/id6743422594?uo=4


      🤩 Hack Features

      - Never Die
      - Unlimited Currency (Always Will Increase Spend)
      - Always Can Use Items (Even when has cooldown)
      • 2 replies
    • Soul Huntress: Dungeon Crawler v1.0.3 [+3 Cheats]
      Modded/Hacked App: Soul Huntress: Dungeon Crawler By Panthera Joint Stock Company
      Bundle ID: com.pantheraplay.soulhuntress
      App Store Link: https://apps.apple.com/ph/app/soul-huntress-dungeon-crawler/id6743422594?uo=4



      🤩 Hack Features

      - Never Die
      - Unlimited Currency (Always Will Increase Spend)
      - Always Can Use Items (Even when has cooldown)
      • 3 replies
    • Tales of Brave doomsday battle v2.1.19 [ +9 Jailed ] ADS NO
      Modded/Hacked App: Tales of Brave doomsday battle By Hakan Aksar
      Bundle ID: com.tianyou.tob
      iTunes Store Link: https://apps.apple.com/us/app/tales-of-brave-doomsday-battle/id6587553322?uo=4
       

      🤩 Hack Features

      - ADS NO [ Rewards Free ]

      - Never Die

      - ONE HiT KiLL

      - Enemy Movement Speed

      - ATK Speed

      - Bullet Max 20

      - Bullet Size Big

      - Enemy Freeze

      - Wall No Hit Enemy


      ⬇️ iOS Hack Download IPA Link


      Hidden Content

      Download via the iOSGods App
      • 22 replies
    • Tales of Brave doomsday battle v2.1.19 [ +9 Cheats ] ADS NO
      Modded/Hacked App: Tales of Brave doomsday battle By Hakan Aksar
      Bundle ID: com.tianyou.tob
      iTunes Store Link: https://apps.apple.com/us/app/tales-of-brave-doomsday-battle/id6587553322?uo=4
       

      🤩 Hack Features

      - ADS NO [ Rewards Free ]

      - Never Die

      - ONE HiT KiLL

      - Enemy Movement Speed

      - ATK Speed

      - Bullet Max 20

      - Bullet Size Big

      - Enemy Freeze

      - Wall No Hit Enemy

       

      ⬇️ iOS Hack Download Link


      Hidden Content

      Download Hack
      • 14 replies
    • Raptor Evolution: Survival v1.0.19 [ +3++ Jailed ] Everything Unlimited
      Modded/Hacked App: Raptor Evolution: Survival By Estoty LLC
      Bundle ID: com.raptor.evolution
      iTunes Store Link: https://apps.apple.com/us/app/raptor-evolution-survival/id6738051188?uo=4

      Hack Features:
      - Resources
      - Energy Cost
      - DMG
      - Upgrade Easy


      Jailbreak required hack(s): https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 14 replies
    • Raptor Evolution: Survival v1.0.19 [ +3++ Cheats] Everything Unlimited
      Modded/Hacked App: Raptor Evolution: Survival By Estoty LLC
      Bundle ID: com.raptor.evolution
      iTunes Store Link: https://apps.apple.com/us/app/raptor-evolution-survival/id6738051188?uo=4

      Hack Features:
      - Resources
      - Energy Cost
      - DMG
      - Upgrade Easy


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/


      iOS Hack Download Link:

      Hidden Content

      Download Hack
      • 15 replies
    • Vampirio: Defend & Survive v1.1.8 [ +2 Cheats ] Currency Max
      Modded/Hacked App: Vampirio: Defend & Survive By Outfit7 Neo Limited
      Bundle ID: com.outfit7neo.onehelsing
      App Store Link: https://apps.apple.com/ph/app/vampirio-defend-survive/id6670539564?uo=4

       

      🤩 Hack Features

      - Currency Max [ Disable After Get ]
      - Resources Max [ Use Only Resources - Disable After Get ] Becasue Linked Population When You Build Disable OtherWise Crash

      • 7 replies
    • Vampirio: Defend & Survive v1.1.8 [ +2 Jailed ] Currency Max
      Modded/Hacked App: Vampirio: Defend & Survive By Outfit7 Neo Limited
      Bundle ID: com.outfit7neo.onehelsing
      App Store Link: https://apps.apple.com/ph/app/vampirio-defend-survive/id6670539564?uo=4


      🤩 Hack Features

      - Currency Max [ Disable After Get ]
      - Resources [ Use Only Resources - Disable After Get ] Becasue Linked Population When You Build Disable OtherWise Crash
      • 9 replies
    • Heroes vs. Hordes: Survivor v5.2.0 [ +11 Cheats ] Currency Max
      Modded/Hacked App: Heroes vs. Hordes: Survivor By Swift Games GmbH
      Bundle ID: com.swiftgames.roguelikesurvival
      iTunes Store Link: https://apps.apple.com/us/app/heroes-vs-hordes-survivor/id1608898173?uo=4

       
      Hack Features

      - Currency

      - Resource

      - Gold Unlimited [ Bonus Wave ]

      - Ch Unlocked [ Play All Off ]

      - Always Last Wave

      - Talents Cost 0

      - Hero DMG Only

      - HP & DMG [ Just Equip & Unequip ]

      - Enemy Freeze

      - Enemy ATK NO

       
      For Non-Jailbroken & No Jailbreak required hacks: https://iosgods.com/forum/79-no-jailbreak-section/
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      • 75 replies
    • Heroes vs. Hordes: Survivor v5.2.0 [ +11 Jailed ] Currency Max
      Modded/Hacked App: Heroes vs. Hordes: Survivor By Swift Games GmbH
      Bundle ID: com.swiftgames.roguelikesurvival
      iTunes Store Link: https://apps.apple.com/us/app/heroes-vs-hordes-survivor/id1608898173?uo=4

       

       

      Mod Requirements

      - Non-Jailbroken/Jailed or Jailbroken iPhone or iPad.
      - Sideloadly or alternatives.
      - Computer running Windows/macOS/Linux with iTunes installed.

       

      Hack Features

      - Currency

      - Resource

      - Gold Unlimited [ Bonus Wave ]

      - Ch Unlocked [ Play All Off ]

      - Always Last Wave

      - Talents Cost 0

      - Hero DMG Only

      - HP & DMG [ Just Equip & Unequip ]

      - Enemy Freeze

      - Enemy ATK NO


      Jailbreak required iOS hacks: https://iosgods.com/forum/5-game-cheats-hack-requests/
      Modded Android APKs: https://iosgods.com/forum/68-android-section/

       

      iOS Hack Download IPA Link


      Hidden Content

      Download via the iOSGods App
      • 88 replies
    • What Duck v1.0.28 [ +6 Cheats ] Currency Max
      Modded/Hacked App: What Duck By Nexelon inc.
      Bundle ID: com.nexelon.duckwars
      App Store Link: https://apps.apple.com/us/app/what-duck/id6744432301?uo=4

      🤩 Hack Features

      - ADS No [ Rewards Free ]

      - Currency

      - Resources

      - Battle Coins

      - Energy

      - Free Pass [ Claim Unlimited ]
      • 12 replies
    • What Duck v1.0.28 [ +6 Jailed ] Currency Max
      Modded/Hacked App: What Duck By Nexelon inc.
      Bundle ID: com.nexelon.duckwars
      App Store Link: https://apps.apple.com/us/app/what-duck/id6744432301?uo=4


      🤩 Hack Features

      - ADS No [ Rewards Free ]

      - Currency

      - Resources

      - Battle Coins

      - Energy

      - Free Pass [ Claim Unlimited ]
      • 20 replies
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines