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

    • Tiny Reaper: Reborn v1.0.2 +4 Jailed Cheats [ God Mode + More ]
      Modded/Hacked App: Tiny Reaper: Reborn By DAERI SOFT
      Bundle ID: com.daerigame.babysasin
      App Store Link: https://apps.apple.com/us/app/tiny-reaper-reborn/id6739761698?uo=4

       


      🤩 Hack Features

      - God Mode
      - One-Hit Kill
      - No Skill Cooldown
      - Dumb Enemies
      • 1 reply
    • Thronefall - A Little Kingdom v2.12.7 +5 Jailed Cheats [ Damage & Defence ]
      Modded/Hacked App: Thronefall - A Little Kingdom By Doghowl Games Ltd
      Bundle ID: com.doghowlgames.thronefall
      App Store Link: https://apps.apple.com/us/app/thronefall-a-little-kingdom/id6744029320?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Unlimited Coins -> Will increase instead of decrease.
      - Free In-App Purchases
      • 19 replies
    • Thronefall - A Little Kingdom v2.12.7 +5 Cheats [ Damage & Defence ]
      Modded/Hacked App: Thronefall - A Little Kingdom By Doghowl Games Ltd
      Bundle ID: com.doghowlgames.thronefall
      App Store Link: https://apps.apple.com/us/app/thronefall-a-little-kingdom/id6744029320?uo=4

       


      🤩 Hack Features

      - Damage Multiplier
      - Defence Multiplier
      - God Mode
      - Unlimited Coins -> Will increase instead of decrease.
      - Free In-App Purchases
      • 16 replies
    • Subway Surfers City v1.24.0 +10 Jailed Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Subway Surfers City By Sybo Games ApS
      Bundle ID: com.sybogames.subway.surfers.game
      iTunes Store Link: https://apps.apple.com/ca/app/subway-surfers-city/id6504188939?uo=4


      Mod Requirements:
      - Non-Jailbroken/Jailed or Jailbroken iPhone/iPad/iPod Touch.
      - Sideloadly / Cydia Impactor or alternatives.
      - A Computer Running Windows/macOS/Linux with iTunes installed.


      Hack Features:
      - Unlimited Coins -> Earn or spend some.
      - Unlimited Keys -> Earn or spend some.
      - Unlimited Revives - Earn or spend some.
      - Unlimited Tokens -> Earn or spend some.
      - All Boards Unlocked
      - All Surfers Unlocked
      - Max Level -> Earn some XP.
      - God Mode
      - Unlimited Score
      - Unlimited Jumps


      Jailbreak required hack(s): [Mod Menu Hack] Subway Surfers City v1.13.2 +7 Cheats [ Unlimited Currencies ] - Free Jailbroken Cydia Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
      • 198 replies
    • Subway Surfers City v1.24.0 +10 Cheats [ Unlimited Currencies ]
      Modded/Hacked App: Subway Surfers City By Sybo Games ApS
      Bundle ID: com.sybogames.subway.surfers.game
      iTunes Store Link: https://apps.apple.com/ca/app/subway-surfers-city/id6504188939?uo=4


      Hack Features:
      - Unlimited Coins
      - Unlimited Keys
      - Unlimited Revives
      - All Boards Unlocked
      - All Surfers Unlocked
      - Max Level -> Earn some XP.
      - God Mode


      Non-Jailbroken & No Jailbreak required hack(s): [Non-Jailbroken Hack] Subway Surfers City v1.13.2 +5 Jailed Cheats [ Unlimited Currencies ] - Free Non-Jailbroken IPA Cheats - iOSGods
      Modded Android APK(s): https://iosgods.com/forum/68-android-section/
      For more fun, check out the Club(s): https://iosgods.com/clubs/
        • Winner
      • 61 replies
    • Tiny Reaper: Reborn v1.0.2 +4 Cheats [ God Mode + More ]
      Modded/Hacked App: Tiny Reaper: Reborn By DAERI SOFT
      Bundle ID: com.daerigame.babysasin
      App Store Link: https://apps.apple.com/us/app/tiny-reaper-reborn/id6739761698?uo=4

       


      🤩 Hack Features

      - God Mode
      - One-Hit Kill
      - No Skill Cooldown
      - Dumb Enemies
      • 1 reply
    • Star Wars™: Galaxy of Heroes Cheats v0.36.7 +8
      Modded/Hacked App: Star Wars™: Galaxy of Heroes By Electronic Arts
      Bundle ID: com.ea.starwarscapital.bv
      iTunes Link: https://itunes.apple.com/us/app/star-wars-galaxy-of-heroes/id921022358?mt=8&uo=4&at=1010lce4


      Mod Requirements
      - Jailbroken iPhone/iPad/iPod Touch.
      - iFile / Filza / iFunBox / iTools or any other file managers for iOS.
      - Cydia Substrate (from Cydia).
      - PreferenceLoader (from Cydia).


      Hack Features
      - No Skill Cooldown time / Skill Always Available. Linked with enemy. Enable when it's your turn, disable when it's enemies turn. Timing is key.
      - One Hit Kill / Very High Damage. This is linked with you and the enemy, use with Skip Enemy Turn feature or enable disable when you attack via the In-Game Mod Menu! Do not kill the last enemy with OHK otherwise the game will crash. This feature is only for x64 or ARM64 iDevices: iPhone 5s, 6, 6 Plus, 6s, 6s Plus, 7, 7 Plus, iPod Touch 6G, iPad Air, Air 2, Pro & iPad Mini 2, 3, 4 and later.
      - Always Your Turn / Skip Enemy Turn. It's always your turn, you're always attacking.
      - Auto Win. You must use this with One Hit Kill in order for it to work. Kill 1 Enemy and you will auto win the battle.
      - Only 1 Encounter on All Missions.
      -- God Mode / Never Die thanks to the features above.

      This hack is now an In-Game Mod Menu. This means you can toggle switches on/off while in a fight. Since God Mode is linked, turn it off when you're attacking and turn it on when the enemy is attacking to do damage but not receive damage. Same goes for the other features.
        • Informative
        • Agree
        • Thanks
        • Winner
        • Like
      • 3,128 replies
    • CSR 2 Drag Racing Car Games v5.8.0 - [ Gold, Cash, Keys & More ]
      Modded/Hacked App: CSR 2 - Realistic Drag Racing By Zynga Inc.
      Bundle ID: com.naturalmotion.customstreetracer2
      iTunes Store Link: https://apps.apple.com/us/app/csr-2-realistic-drag-racing/id887947640?uo=4

       

      📌 Mod Requirements

      - Jailbroken iPhone or iPad.
      - iGameGod / Filza / iMazing.
      - Cydia Substrate, ElleKit, Substitute or libhooker depending on your jailbreak (from Sileo, Cydia or Zebra).

       

      🤩 Hack Features

      - Custom Gold Amount -> Enter the amount of gold you want inside the iOSGods Mod Menu!
      - Custom Cash Amount -> Enter the amount of cash you want inside the iOSGods Mod Menu!
      - Custom Keys Amount -> Enter the amount of keys you want inside the iOSGods Mod Menu!
      - Anti-Ban -> Also unbans previously banned accounts and lets you play online according to feedback.
      - No Fuel Consumption
      - Instant Part Delivery
      - Instant Car Delivery
      - Gold Increase
      - Cash Increase
      - Keys Increase
      - Buy Anything For 1 Gold
      - Buy Anything For 1 Cash

       

      Non-Jailbroken Hack: https://iosgods.com/topic/168529-csr-2-drag-racing-car-games-v551-4-jailed-cheats/

       

      ⬇️ iOS Hack Download Link: https://iosgods.com/topic/73095-csr-2-drag-racing-car-games-v561-gold-cash-keys-more/.
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 5,728 replies
    • Genshin Impact Cheats v5.7.0 +3
      Modded/Hacked App: Genshin Impact by miHoYo Limited
      Bundle ID: com.miHoYo.GenshinImpact
      iTunes Store Link: https://apps.apple.com/us/app/genshin-impact/id1517783697?uo=4&at=1010lce4


      Hack Features:
      - Instant Skill
      - Instant Special Skill (Elemental Burst)
      - Infinite Stamina
        + Infinite Sprint Time
        + Infinite Swim Time
        + Infinite Fly Time


      iOS Hack Download Link: https://iosgods.com/topic/134035-genshin-impact-cheat-v101-3-instant-skill-more/
        • Informative
        • Agree
        • Haha
        • Thanks
        • Winner
        • Like
      • 3,637 replies
    • Modern Strike Online: War FPS Cheats v1.76.6 +10
      Modded/Hacked App: Modern Strike Online: War FPS By AZUR INTERACTIVE GAMES LIMITED
      Bundle ID: com.gamedevltd.modernstrikeonline
      iTunes Store Link: https://apps.apple.com/us/app/modern-strike-online-war-fps/id1197441484?uo=4


      Hack Features:
      - Radar Hack
      - Increase FireRate
      - Unlimited Ammo
      - No Spread
      - Night Vision Enabled
      - Instant Kill
      - God Mode
      - No FlashBang
      - Super Speed
      - No MedKit CoolDown

      Note:
      Not Responsible For Any Bans


      Non-Jailbroken & No Jailbreak required hack(s): https://iosgods.com/topic/186634-modern-strike-online-war-fps-v1687-jailed-cheats-10/


      iOS Hack Download Link: https://iosgods.com/topic/186633-modern-strike-online-war-fps-cheats-v1693-10/
        • Agree
      • 89 replies
    • Township: Farm & City Building v28.1.0 Jailed Cheats +2
      Modded/Hacked App: Township by PLR Worldwide Sales Limited
      Bundle ID: com.playrix.township-ios
      iTunes Store Link: https://apps.apple.com/us/app/township/id638689075?uo=4&at=1010lce4


      Hack Features:
      - Freeze Currencies

      EDIT: Please be aware that this maybe cause your account banned, please use with caution and don’t abuse


      iOS Hack Download Link: https://iosgods.com/topic/116584-arm64-township-farm-city-building-v852-jailed-cheats-2/
        • Agree
      • 1,692 replies
    • MergeHeroRoyale v1.0 [+2 Jailed Cheats]
      Modded/Hacked App: MergeHeroRoyale By Ferhat TEPE
      Bundle ID: com.gnarlygamestudio.mergeheroroyale
      App Store Link: https://apps.apple.com/us/app/mergeheroroyale/id6745405612?uo=4



      🤩 Hack Features

      - Add Gold (Enable and spend some)
      - Add Mana (Enable inside battle)
      • 3 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